We are developing a completely new mobile version of our site, it is a HTML5 site written using Sencha Touch 2 (Ext JS, JavaScript).
We are using Google Analytics on our main site, and we would like to use GA on the mobile site as well. However our desired use case is a little special: We would like hits to articles on the mobile site to be tracked as hits to the corresponding article on the main site. The reasoning behind this is the desire to aggregate the statistics, and not have the data tracked separately.
The domains and URL structure is different for the two sites, although the site hierarchy is somewhat similar (they both get content from a Sharepoint backend), and herein lies the challenge. We cannot only change the domain using something like 'setDomainName'.
On every page in the mobile version, we have available the full URL to the original page/article on the main site. What we would like to do is tell Google to track the view as a hit to that URL instead of the one we are actually on.
I've seen some threads (f ex here) regarding 'trackPageView' and it may be sufficient for our needs, however I am not entirely sure. It sounds a little too simple, but it may also be that I am not seeing the obvious solution here. Could we provide this method with the desired hit URL and that's it? Would it work then to have a script in the header that checks for a set variable with this URL, and if it exists call 'trackPageView' with it as a parameter, if not just track a regular hit? Any help with syntax for this approach is welcome.
All help & suggestions appreciated here! I've scoured GA docs without much helping information on this special case.
Yes it is that simple use the track page view event and pass the corresponding URL parameters. In sencha all your views are going to exist in the same HTML page so you need to call this programmatically.
Include the same tracking code as you use in your live site with the same ID... This should work as you expect... Very good question...Hope it helps...
Here's GA Tracking spelled out and made simple for ST2+. I've included how to initialise, set up basic navigation tracking, and several alternatives including custom variable & event tracking.
I found this article talking about Google Analytics and Sencha Touch
http://wtcindia.wordpress.com/2013/03/21/using-google-analytics-in-sencha-touch-based-mobile-website/