Skip to Content
AI Powered Docs! 🤖 These docs are translated with AI, so keep an eye out for minor quirks. We're always improving!

Attribution Status

In some scenarios, you may need to check the user’s attribution status. For this purpose, you can use the following method:

getAttributionStatus();

This method returns one of the following values:

ValueDescription
ATTRIBUTEDThe user has been successfully attributed to a campaign.
NOT_ATTRIBUTED_YETThe attribution process is still in progress and the final result is not yet determined.
ATTRIBUTION_NOT_NEEDEDThe user is organic or not part of any marketing campaign; therefore, attribution is not required.
UNKNOWNThe attribution status of the user is currently unknown.

Example usage:

const status = getAttributionStatus(); switch (status) { case 'ATTRIBUTED': console.log('User is attributed'); break; case 'NOT_ATTRIBUTED_YET': console.log('Attribution is not completed yet'); break; case 'ATTRIBUTION_NOT_NEEDED': console.log('Attribution is not required'); break; default: console.log('Unknown attribution status'); }

Counting Installs and Tracking User Sessions (For Attribution Service)

To enable user session tracking via the Metrix SDK, include the following configuration inside the config object — the third parameter of the init method:

{ sessionTracking: { enabled: true; // default is false. packageName: 'YOUR_APP_PACKAGE_NAME'; } }

Counting Installs in TWA Apps

Since identifiers required for attribution (such as Google Advertising ID) are not accessible in a web environment, and in TWA (Trusted Web Activity) the only communication link between the native Android app and the web app is the Launch URL, to ensure accurate attribution and install counting, the Android app must retrieve the required identifier using Google’s libraries and append it as a query parameterto the web app’s launch URL.

Add the following dependency to your Android project to access the Google Advertising ID:

com.google.android.gms:play-services-ads-identifier:18.0.1

You can find the official documentation for retrieving the Google Advertising ID from this link  :

This ID must be added with the key gps_adid to the query parameters of the web app launch URL, as in the following example:
https://domain.example?gps_adid=DEVICE_ADVERTISING_ID

Sample TWA implementations that demonstrate how to retrieve the Google Advertising ID are available for both Java  and Kotlin 

Counting Installs in PWA Apps

In Progressive Web Apps (PWAs), since there’s no access to a unique device identifier, the first user session is considered the app installation. Therefore, to count installs in PWAs, no special setup is required — just ensure session tracking is enabled as described earlier.

Retrieving the Unique Identifier

For every device that installs your app, Metrix generates a unique identifier. You can access this ID right after the device is recognized using the following method:

onMetrixUserIdReceived().then((metrixUserId: string) => { // todo });

This identifier is useful when you need to send events Server-to-Server to Metrix via the API.