开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜