Using setCampaignParamsOnNextHit (Android) and the iOS equivalent for attribute users in Google Analytics

After reading the tutorial on setting up the APIs for Android and iOS for campaign / user attribution in Google docs, I'm a little confused about how to read the parameters. We use a third-party library to collect data from our campaign, so I have a list of keys such as utm_source, utm_campaign, etc., which led to the installation of the application by the user. I want to tell GA to use these parameters every time it sends an event.

Now, according to the Android manual, it seems that I want to use public void setCampaignParamsOnNextHit (Uri uri)and recode utm_ * variables in URI format. Should this method be called before each event being monitored?

Android Guide: https://developers.google.com/android/reference/com/google/android/gms/analytics/Tracker.html#public-methods

The confusion stems from the fact that I have read in iOS guide: Note that in the following examples, campaign data is not set on the tracker directly, as it only needs to be sent once. This is not like I will need to recode any variables as I can just go to the dictionary here.

IOS Guide: https://developers.google.com/analytics/devguides/collection/ios/v3/campaigns#general-campaigns

I can encode any language to either always call the dialing method before calling the track, or simply set it once. Although, can anyone give any clarity with these APIs? Ideally, I would like to track all events with these source attributes.

+4

All Articles