fannheyward
fannheyward

Reputation: 19277

How to exclude self-traffic in Google Analytics on iPhone?

I'm using Google Analytics iOS SDK to traffic app events and pageviews. It works great.

When I code/debug the app, I don't want Google Analytics to traffic my events or pageviews, cause they're useless. So, is there a way to exclude self-traffics on iPhone with Google Analytics iOS SDK?

Thanks.

Upvotes: 3

Views: 1044

Answers (2)

Sid
Sid

Reputation: 9536

What I do for Google Analytics is have seperate account ID's for live apps and for debugging.

I store the account ID to be used in the app inside a plist. So when the time comes to debug the app I change the account ID from the live ID to the debugging ID.

Upvotes: 2

jaminguy
jaminguy

Reputation: 25930

You could put an #ifndef around the code that starts tracking. Define a custom User-defined build setting for your Debug configuration called __DEBUG__ then use it in your code like this:

#ifndef __DEBUG__

//code to start analytics tracking

#endif

This will prevent your debug builds from tracking but your release/distribution builds will track properly.

Upvotes: 2

Related Questions