Analytics
5K members online now
5K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

enable demographic tracking on android app

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

hey, i read this guide https://support.google.com/analytics/answer/2444872?hl=en-GB&utm_id=ad#app 

for enable demographic reports for android apps and i did not understand what part of the following code should i implement and where:

 

here is the code including the instructions:

 

To enable these features for Android, modify your Analytics tracking code to collect the advertising id. Call the enableAdvertisingIdCollection method on the tracker for which you want to enable these features. For example:

// Get tracker.
Tracker t = ((AnalyticsSampleApp) getActivity().getApplication()).getTracker(
TrackerName.APP_TRACKER);

// Enable Display Features.
t.enableAdvertisingIdCollection(true);

 

 

Re: enable demographic tracking on android app

A T
Participant ✭ ✭ ✭
# 2
A T
Participant ✭ ✭ ✭
Just before you are sending the screenviews, you need to add the code.

https://developers.google.com/analytics/devguides/collection/android/v4/screens

Get tracker code might already be there in your code.

Just add:

// Enable Display Features.
t.enableAdvertisingIdCollection(true);

https://developers.google.com/android/reference/com/google/android/gms/analytics/Tracker#enableAdver...)

Re: enable demographic tracking on android app

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
thank you.

so i need to check if the Get tracker code is already in there and than add these 2 lines?
// Enable Display Features.
t.enableAdvertisingIdCollection(true);

Re: enable demographic tracking on android app

A T
Participant ✭ ✭ ✭
# 4
A T
Participant ✭ ✭ ✭
That's right.