React Native implementation / Media & Sections

Amalie Updated by Amalie

React Native implementation

These instructions cover the implementation of your Publisher script in your application. For the Media Metrics Finland measurement solution we use the UserReport SDK.

Installation

The UserReport SDK and it’s dependencies should be installed with npm:

Only for Android installations

Update your AndroidMainfest.xml file and declare that your app is an Ad Manager app, as instructed on Google's Ad Manager guide:

Only for iOS installations

Install Pods dependencies:

Update your Info.plist with message that will inform the user why app is requesting permission to use data for tracking:

Starting iOS 14.5 you’ll need to receive user’s permission to access device advertising identifier, that behavior can be manually disabled for older iOS versions with following command:

Configuration

Configure the SDK using your Publisher ID and your Media ID. For iOS applications, use the iOS Media ID. For Android Applications, use the Android Media ID. 

Your Publisher ID and Media IDs are found by following the guide in the Where to find your measurement script and identifiers article

While developing, it is recommended to enable the debug mode. This will help you understand if the SDK is configured correctly. All errors will be written to the console:

Note that only Android and iOS are supported. Invoking configure on other platforms will return an error.

Screen tracking

Every time a user is navigated to a new screen in the application this needs to be registered with a 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 view appearance 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 in the appendix at the end of this document. The section taxonomy in the appendix is a standard defined by Media Metrics.

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 IDs outlined in the appendix. And it needs to be determined by code depending on displayed content.

How did we do?

Native App implementation / How to manage consent implementation

iOS App implementation / Media & Sections

Contact