App tracking
Track mobile and CTV applications through the tracking API, with signature authentication.
Your goal
Send activities from your mobile or CTV application to the platform, authenticated in a way that is safe for code running on a user's device.
Expected outcome
App activities arriving with the right activity type, the right channel ID, and correctly formatted device identifiers - and no long-term token embedded in the application.
What app tracking requires
None of these requirements are optional:
The tracking API
All user activities are sent using the tracking API - there is no app SDK to install.
Signature authentication
Requests between your application and mediarithmics are authenticated with signature authentication. See Manage API access.
Correct payload
The activity and events must follow the specifics below.
Correctly formatted $user_agent_id
Device identifiers use the formats described in UserDevice & UserDeviceTechnicalId.
Ways to integrate
Call the API from the app
Integrate a small piece of code - around 100 lines - into the application to make the calls to the tracking API. Complete samples for iOS, Android, Tizen and webOS, Android TV and Roku are below.
The second option keeps the credential on your servers rather than in the app, at the cost of depending on the other tool's export.
Activity formatting
$type
String enum
Must be APP_VISIT.
$session_status
String enum
See the session status guidance below.
$user_agent_id
String, optional
The user agent identifier of the device, in the unified representation.
$app_id
String
The mobile app ID - the channel, created beforehand in Navigator or through the API.
$type
String enum
Must be CTV_VISIT.
$session_status
String enum
See the session status guidance below.
$user_agent_id
String, optional
The user agent identifier of the device, in the unified representation.
$ctv_id
String
The CTV app ID - the channel, created beforehand in Navigator or through the API.
Choosing a session status
This is the decision that shapes your integration:
IN_SESSION
Recommended. One API call per tracked event.
The platform automatically aggregates all the events of a session sent across many calls.
CLOSED_SESSION
Only if you make a single API call per session, at its end.
You must provide all the events of the session in the $events array. Each call with this value generates a new user activity.
Predefined app events
Predefined event names are available out of the box to simplify and automate event processing:
$app_open
The app was opened, or resumed and became active again.
You.
$app_install
The app was installed.
The platform. Triggered the first time an app open event is received for a user, whether the user is new or existing.
$app_update
The app was updated.
The platform. Triggered when the SDK version, app version, or OS version changes from one open to the next.
The full catalogue is in UserActivity & UserEvent.
Sample integration
Each sample below is a complete integration for one platform: it signs the payload with HMAC-SHA256, builds an activity of the shape described above, and posts it to the tracking API. The signPayload function every sample opens with is the digest specification documented on Manage API access.
Replace the placeholder constants with your own values - the datamart ID, the channel ID that goes in $app_id or $ctv_id, the compartment and registry IDs, and the secret key with its key_id.
Verify
The
APIstep shows events in ingestion monitoring. See Monitor data ingestion.Activities appear with type
APP_VISITorCTV_VISITand the expected channel ID.Device identifiers resolve to a device point rather than being dropped, which means the registry exists.
$app_installappears once for a new user, without you sending it.
Troubleshooting
Calls are rejected
The signature is computed over the wrong message. Check the order uri, key_id, timestamp, body, separated by \n.
One activity per event instead of a session
$session_status is CLOSED_SESSION - each such call creates a new activity.
Device identifiers do not appear
The $user_agent_id format is wrong for the registry type, or the registry does not exist.
Events land on the wrong property
$app_id or $ctv_id points at the wrong channel.
Related pages
Last updated
Was this helpful?