Submitting details.
Please wait ...

Blog

Tracking virtual page views with analytics.js

11th, June 2014

Virtual pages are commonly used, for example, to record successful form submissions when your site does not have a static "thank you" page. Tracking with the previous _ga.js_ was as simple as inserting the following (example) line of code -

_gaq.push(['_trackPageview','/thank-you'])

- upon a succesful form submission. But how about the new _analytics.js_ ? With only some minor adjustments, the above code will now look like -

ga('send', 'pageview', '/thank-you')

For further reading on this, and the other changes from ga.js to analytics.js, you can visit the Google Developers' Google Analytics Reference at https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs

-- Riz

quick search