Recently we switched over our Google Analytics code to the new and improved asynchronous tracking code. The new async analytics code claims to provide more accurate visitor tracking and also allows you to put the tracking snippet higher in the page without delaying subsequent content from rendering.
Unfortunately, when we made the switch to analytics asynchronous, we couldn’t figure out how to migrate two essential things.
- The first was event tracking. Event tracking allows analytics to track when a particular link or promo (video/image) is clicked.
- The second was setting a goal from a form that is submitted via AJAX. Our sign up form submits via AJAX, and thus there is not a traditional thank you page.
No need to worry though, we figured it all out, and have both solutions. Watch the video tutorial below for a full detailed explanation.
Event Tracking Javascript Code Snippet
_gaq.push(['_trackEvent', 'Videos', 'Viewed', 'How It Works']);
Set Goal (Virtual Pageview) Code Snippet
_gaq.push(['_trackPageview', '/sign-up-complete.php']);



Nice work, thank you
This is really nice..the video was an added help
Thanks!!
[...] forms that are submitted by AJAX were no longer being tracked by Analytics. They came up with the solution and even produced a video on how to take care of these problems simply and [...]
[...] Tracking Events And Goals With Google Analytics Asynchronous en 619Cloud [...]
Cheers for the info on the virtual page view using the new GA code.
Justin, you’re a savior with this one. I can’t believe there is no explicit syntax example/description within code.google.com explaining how to set a virtual page view. Nice explanation!
Thank you. This is a huge help. Appreciate it guys.
Thanks, that was exactly what I was looking for. I make massive use of “virtual pageviews” mapped to goals, then to AdWords Conversions.
[...] Tracking Events And Goals With Google Analytics Asynchronous (619cloud.com) [...]
Hi Everybody…
Nice post… btw, I just modified the Google Analytics plugin for WordPress and added the new asynchronous tracking method… Please review my post about Asynchronous Google Analytics plugin for WordPress at http://www.minilibra.com/wordpress/plugins/analytics.html
Cheers
Bambang Sugiarto
Thanks for the tip! Hopefully Google will allow us to set Event Tracking as a goal or at least offer more information re: Virtual Pageview with async.
The topic is an issue I am trying to resolve, but why oh why make a video about it?
10 minutes into downloading the video and I am only half way through watching (I live in South Africa)
Everytime you say Aaaaam or errrm or ummmmm it is more data to download, how about writing yourself a script!
And it took me this long to find out that this video does not resolve my ajax issues. Video does not scan
The information looks great. But i have a small doubt on setting goal for AJAX pages. Can we use the code
_gaq.push(['_trackPageview', '/sign-up-complete.php']);
with the analytics code instead of having it in the Javascript. will this work fine and track goals if i add in my website.
The information looks great. But i have a small doubt on setting goal for AJAX pages. Can we use the code
_gaq.push(['_trackPageview', '/sign-up-complete.php']);
with the analytics code instead of having it in the Javascript. will this work fine and track goals if i add in my website.
The information looks great. But i have a small doubt on setting goal for AJAX pages. Can we use the code
_gaq.push(['_trackPageview', '/sign-up-complete.php']);
with the analytics code instead of having it in the Javascript. will this work fine and track goals if i add in my website.
The information looks great. But i have a small doubt on setting goal for AJAX pages. Can we use the code
_gaq.push(['_trackPageview', '/sign-up-complete.php']);
with the analytics code instead of having it in the Javascript. will this work fine and track goals if i add in my website.
Super useful, thanks for sharing!