Android App implementation / Media & Sections

Amalie Updated by Amalie

Android implementation

This instruction covers the implementation of your Publisher Script in your Android application. For screen/section tracking Android SDK 19 (Android 4.4) or higher is required.

For the Media Metrics Finland measurement solution we use the UserReport SDK.

Installation

The SDK can be installed via either Maven or Gradle. 

Thereafter, add AudienceProject into the proguard-rules.pro file, so it won't be obfuscated (app/proguard-rules.pro).

 

 

 

Since the SDK relies on the AAID, you need to configure either AdMob or Google Ad Manager. 

When using Google Ad Manager

When using Google Ad Manager for AAID access, declare that your app is an Ad Manager app by adding the following tag in your AndroidManifest.xml.

When using Ad Mob

When using Ad Mob for AAID access, add your AdMob app ID to AndroidManifest.xml file by adding a <meta-data> tag with name com.google.android.gms.ads.APPLICATION_ID, as shown below. 

You can find your app ID by signing in to your AdMob account (at https://apps.admob.com), clicking on ‘Apps’ in the sidebar and clicking ‘View all apps’. Your app ID can now be copied from the ‘App ID’ column for your application.

In the example below you would need to replace “ca-app-pub-xxxxxxxxxxxxxxx~yyyyyyyyyy” with your unique app ID

Configuration

Configure the SDK using your Publisher ID and your Media ID.

Your Publisher ID and Media ID's by following the guides in the Where to find your measurement script and identifiers article.

Configure the UserReport instance on Application startup, and make sure you store the instance of UserReport. See example below:

Screen tracking

Every time a user is navigated to a new screen in the application this needs to be registered with UserReport.trackScreenView() invocation. Depending on your application architecture it may be in different places. Below you can find the most simple example in which every activity creation is measured as a new screen view.

Section tracking

Sections allow you to measure and report usage/traffic at a more granular level across your different media properties. Sections could be “News” and “Sports” which are associated with each pageview logged. Every section has a unique ID. You can find your unique section IDs by following the guides on the Where to find your measurement script and identifiers article.

Whenever a new screen appears that can be associated with a section this needs to be registered by invoking UserReport.trackScreenView() followed by an invocation of UserReport.trackSectionScreenView(sectionId).

The sectionId parameter needs to be one of the predefined Section ID’s you created when you created sections while preparing your account. And it needs to be determined by code depending on displayed content.

How did we do?

In App consent implementation via. Google Tag Manager

Contact