开发者

How to verify google analytics when you don't have a site attached to an application on the iphone?

开发者 https://www.devze.com 2023-01-23 23:22 出处:网络
How can I verify my google analytics tracking code without having an actual website? I\'m just going to use it for my 开发者_如何学Pythonapp tracking (pageviews/events).If you don\'t have a website bu

How can I verify my google analytics tracking code without having an actual website? I'm just going to use it for my 开发者_如何学Pythonapp tracking (pageviews/events).


If you don't have a website but instead what to track activity inside a mobile application you will need to use the Google Analytics Mobile SDK (http://code.google.com/mobile/analytics/docs/).

I would try creating test code that hits the API with your tracking ID and see if it shows up in the Google Analytics dashboard.


Make sure you init the library with your app's analytics id:

[[GANTracker sharedTracker] startTrackerWithAccountID:@"your-apps-google-analytics-id"
                                       dispatchPeriod:15
                                             delegate:nil];

#if DEBUG
    NSLog(@"******* WARNING: ANALYTICS IN DRY RUN MODE! *******");
    [[GANTracker sharedTracker] setDryRun:YES]; // DO NOT COLLECT ANALLYTICS
#endif

Track screen views as if they were page hits:

[[GANTracker sharedTracker] trackPageview:@"/Tutorial" withError:nil];

Track event/actions:

[[GANTracker sharedTracker] trackEvent:@"Registration"
                                action:@"Skipped"
                                 label:nil
                                 value:0
                             withError:nil];
0

精彩评论

暂无评论...
验证码 换一张
取 消