I have a single app, but depending of user's choice, it will be monitored totally separated in google analytics, so I NEED to set "ga_trackingId" for EasyTracker programmatically.
I've tried EasyTracker.getTracker().setAppId(id) with no luck.
The accepted answer didn't work for me, as I saw this in my logs:
`W/GAV3﹕ Thread[main,5,main]: Missing tracking id (&tid)`
The solution for analytics v3 is:
EasyTracker tracker = EasyTracker.getInstance(getContext());
tracker.set("&tid", "UA-XXXX-2");
Calling it this way got rid of the error and I can see my events on the analytics page.
For changing the id for the EasyTracker, do this:
onStart()
EasyTracker.getInstance(this).set(Fields.TRACKING_ID, "<your_ga_id");
EasyTracker.getInstance(this).activityStart(this);
onStop()
EasyTracker.getInstance(this).activityStop(this);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With