Google released asynchronous tracking for Google Analytics earlier this year and I posted an example HTML page showing how to insert the code. On my just released New Zealand Running Calendar website I use jQuery Facebox popups to render a lot of content and wanted those to get tracked as additional pageviews. This post therefore shows how to track additional pageviews when using Google Analytics asynchronous tracking.
Tracking another pageview
Somewhere in the page the following code needs to be triggered, where /full/path/to/page is the page you want tracked in Google Analytics as a regular pageview:
Running Calendar example in jQuery popup
On my Running Calendar website, the content is loaded into a jQuery Facebox “popup” as shown in the screenshot below:
In the case of this website, it’s using Silverstripe and the part of the template in question looks more or less like this:
$link is a template placeholder which is replaced with the full URL for the page.
Now whether someone loads the running event page in one of these inline popups it will trigger an additional pageview in Analytics so I can get a good gauge of the number of event pages that are being looked at. Without this additional tracking it would be impossible to know.