简体   繁体   中英

Campaigns not reported in Google Analytics SDK v2 on iOS

I've integrated Google Analytics SDK v2 on both Android and iOS and I am stuck on a campaign issue only with the iOS version of the SDK. The setCampaignUrl works great on Android but completely does not report anything on a iPhone.

The tracker is correctly initialized since all the other methods are working correctly on iOS and I am doing it like the following:

id<GAITracker> tracker = [GAI sharedInstance].defaultTracker;
    if (tracker) {
        tracker.campaignUrl = [NSString stringWithCString:campaignUrl encoding:NSUTF8StringEncoding];
    }

I've also tried setCampaignUrl:campaignUrl without success.

The campaign URL is the one given as example on Google Analytics web site ("utm_campaign=my_campaign&utm_source=google&utm_medium=cpc&utm_term=my_keyword&utm_content=ad_variation1") and do the job on Android.

Am I correctly using it, have you encountered a similar issue? Could it be a Analytics SDK issue?

Other developers reported the same issue on a Google group thread ( http://productforums.google.com/forum/#!topic/analytics/sbUOYuhaMc8 ) which might mean that it could be a Google issue.

Thanks for your help.

Found the solution, the documentation on Google Analytics web site is wrong in the iOS part :

The campaign URL given as example on Google Analytics web site ("utm_campaign=my_campaign&utm_source=google&utm_medium=cpc&utm_term=my_keyword&utm_content=ad_variation1") do the job on Android but on iOS it has to be a well formatted web url such as:

http://www.google.com?utm_campaign=my_campaign&utm_source=google&utm_medium=cpc&utm_term=my_keyword&utm_content=ad_variation1

to be reported on Analytics. They are certainly using a regex because any random site name would work and be careful, the site cannot contain "/" after the ".com"

Same for setReferrerUrl:referrer you cannot use a string like "google.com" or "myOtherApp" as mentionned by Google but instead a valid url such as " http://www.google.com " or " http://test.com/2 "

Hope it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM