I am trying to port this javascript version of GA to native iOS SDK
pageTracker = _gat._getTracker("UA-XXXXXXX-1");
pageTracker._setDomainName(".test.org");
pageTracker._trackPageview();
I know how to set the UA account and how to report a pageView, but how do I set the domain name ?
[[GANTracker sharedTracker] startTrackerWithAccountID:@"UA-XXXXXXX-1"
dispatchPeriod:kGANDispatchPeriodSec
delegate:nil];
if (![[GANTracker sharedTracker] trackPageview:@"/"
withError:&error]) { // Handle error here }
Just following up from my comments. You don’t need domain in the Google Analytics native code tracker for iOS. It’s used on the web so you can track traffic at a more granular level on sites where multiple sub-domains might be used. For example, if you have a generic “Products” web page, but the same Products page lives on dogs.mystore.com/products and cats.mystore.com/products, and you want to use the same tracker but differentiate the traffic between those two sites, you can leverage the domain variable in the Javascript API. I can’t think of a use case like this where it would be needed behind a native app.
Here’s a reference for it related to the JavaScript API
https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite
Bottom line, it’s not needed. 🙂