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']);

How To Setup The Goal In Google Analytics

Goal Setup Google Analytics