jquery address google analytics
I'm using the popular jquery address with an ajax app. I want google analytics to record path hash changes, as those are the equivalent of new pages for me.
The address documentation mentions GA, but I don't understand how to use it?
http://www.asual.com/jquery/address/docs/
This also mentions the feature but doesn't explain how to do tracking: jquery deep linking - how does it effect analytics?
Do I 开发者_如何学编程still reference the google urchin js on my html page? Below or after address? Is the function the function that causes the page change? Can I put $.address.change() in it?
The plugin should do the tracking automatically as long as you have included one the Google Analytics code. It supports the all the variants of the code (urchin, pageTracker, async) but there are two important things:
- The GA code should be included before the plugin. This is needed so that the plugin can detect the tracking script.
- The last line of the tracking code where the "" is tracked should be removed. The plugin will invoke this automatically and will use a proper value if the website is entered using a deep link.
All the jQuery Address samples on asual.com use this tracking capability and you can use their source as a reference.
精彩评论