Skip to main content
All CollectionsAffise MMP V1 (embedded in Affise Performance)API
API Attribution - Affise MMP without SDK integration
API Attribution - Affise MMP without SDK integration
Daria Mamchenkova avatar
Written by Daria Mamchenkova
Updated over 7 months ago

If it's not possible to integrate with the SDK, you can use API Attribution. In this case, you should do the following:

  1. On the Application page, add an application and indicate its SDK secret key and App ID.

  2. Set the request according to the guide in this article.

  3. Integrate Google Play referral library.

Settings

Minimal postback to install not organic metric

curl --request POST \

--data '[

{

"uuid": "1a7adcca-f786-4c62-a770-5b3e687d0ee3",

"created_time": 1668605535000,

"affise_app_id": "3",

"affise_pkg_app_name": "com.test.app",

"affise_app_token": "ee8ebe706e0359e3ac5c45666a681f4c228d97f20012dac186ae3902eb479955",

"affise_device_id": "bf62b34b-5750-4e95-a132-4185cedbee00",

"random_user_id": "92f254db-d70d-47ce-8597-baccab852300",

"first_open_time": 1685452724264,

"referrer":"gclid=CjwKCAjwvdajBhBEEiwAeMh1UwCsBajGUaMGwuqg6-nhQQe54jA4hR3l5wUQK5OB_GH_OxlAizBIQRoCRGAQAvD_BwE"

}

]'

If the referrer parameter is empty or invalid, install will be organic if other definition is not used.

Postback for sessions and/or check active user

curl --request POST \

--data '[

{

"uuid": "1a7adcca-f786-4c62-a770-5b3e687d0ee3",

"created_time": 1668605535000,

"affise_app_id": "3",

"affise_pkg_app_name": "com.test.app",

"affise_app_token": "ee8ebe706e0359e3ac5c45666a681f4c228d97f20012dac186ae3902eb479955",

"affise_device_id": "bf62b34b-5750-4e95-a132-4185cedbee00",

"random_user_id": "92f254db-d70d-47ce-8597-baccab852300",

"first_open_time": 1685452724264,

“last_session_time”: 1685452756000,

“last_time_session”: 1685452756000,

“time_session”: 56783,

“affise_session_count”: 5,

“lifetime_session_count”: 4556891

}

]'

where:

Name

Type

Required

Information

uuid

uuidv4 (string)

Every

Postback identifier, a unique value for each postback.

created_time

timestamp (int)

Every

Postback sending time in milliseconds.

affise_app_id

string

Every

Application ID on Affise.

affise_pkg_app_name

string

Every

Package name in store.

affise_app_token

string

Every

Postback signature.

affise_device_id

uuidv1 (string)

Every

User's unique device identifier.

random_user_id

uuidv4 (string)

Every

User's unique device identifier.

first_open_time

timestamp (int)

First postback

Time of the first launch of the application in milliseconds.

Unique for the device.

Must be submitted at least 1 time.

It may not be present in the following postbacks.

referrer

string

Non or first postback, for non-organic check

Referrer info from a store.

If another mechanism is used to check non-organic, the field is optional.

last_session_time

timestamp (int)

For sessions

Current time in milliseconds if session is active, else 0.

last_time_session

timestamp (int)

For sessions,

if last_session_time = 0

Current time in milliseconds if session is active, else

last time in milliseconds when session was active, else

first_open_time.

time_session

int

For calc duration sessions

Last session duration in milliseconds.

affise_session_count

int

For sessions

Number of non-fraud sessions on the device.

Affise recommends increasing this counter 30 seconds after the start of session.

Value should not decrease.

lifetime_session_count

int

For calc durations sessions

Sum of application activity durations in milliseconds.

Loot at the full postback example:

[

{

"affise_app_id": "3",

"affise_pkg_app_name": "com.test.app",

"app_version": "1.0",

"app_version_raw": "2",

"store": "Apk",

"installed_time": 1685445035570,

"first_open_time": 1685445103532,

"installed_hour": 1685444400000,

"first_open_hour": 1685444400000,

"install_first_event": true,

"install_begin_time": 0,

"install_finish_time": 1685445103532,

"referrer_install_version": "",

"referral_time": 0,

"referrer_click_time": 0,

"referrer_click_time_server": 0,

"referrer_google_play_instant": false,

"created_time": 1685445103000,

"created_time_milli": 1685445103908,

"created_time_hour": 1685444400000,

"last_session_time": 1685445103908,

"connection_type": "WIFI",

"cpu_type": "arm64-v8a, armeabi-v7a, armeabi",

"hardware_name": "coral",

"network_type": "WIFI",

"device_manufacturer": "Google",

"proxy_ip_address": "",

"deeplink_click": false,

"device_atlas_id": "",

"affise_device_id": "6c5b4fbb-0188-1000-a2a8-a425dfc3a5d1",

"affise_alt_device_id": "6c5b4fd6-0188-1000-8d42-38592460a3c0",

"adid": "",

"android_id": "50da7b69cab425a1",

"android_id_md5": "f2e24f12834014cf69623fd9a7c77f12",

"mac_sha1": "",

"mac_md5": "",

"gaid_adid": "",

"gaid_adid_md5": "",

"oaid": "",

"oaid_md5": "",

"altstr_adid": "",

"fireos_adid": "",

"coloros_adid": "",

"reftoken": "6c5b51…ac5631",

"reftokens": "6c5b5…59c94f0a",

"referrer": "referrer=018…a43e29&clickid=6475e…e37f55&pid=9",

"user_agent": "Dalvik/2.1.0 (Linux; U; Android 13; Pixel 4 XL Build/TP1A.221005.002.B2)",

"mccode": "272",

"mncode": "2",

"isp": "3",

"region": "IE",

"country": "IE",

"language": "en-IE",

"device_name": "Pixel 4 XL",

"device_type": "smartphone",

"os_name": "",

"platform": "android",

"sdk_platform": "android",

"api_level_os": "33",

"affise_sdk_version": "-",

"os_version": "13",

"random_user_id": "6c5b4fea-0188-1000-90fb-29759c0aadba",

"affise_sdk_pos": "Production",

"timezone_dev": "UTC+0100",

"affise_event_token": "",

"affise_event_name": "",

"last_time_session": 1685445104000,

"time_session": 295,

"affise_session_count": 1,

"lifetime_session_count": 295,

"affise_deeplink": "",

"affise_part_param_name": "",

"affise_part_param_name_token": "",

"affise_app_token": "9d1af455f1…66611d7e72e9",

"label": "",

"uuid": "6c5b5181-0188-1000-ab71-0cbd7e8a63e2",

"pushtoken": "",

"affise_events_count": 2,

"events": [

{

"affise_event_id": "4fc7d613-af35-4298-92a8-04838e03a40c",

"affise_event_name": "CustomId01",

"affise_event_category": "native",

"affise_event_timestamp": 1685449930539,

"affise_event_first_for_user": false,

"affise_event_user_data": "",

"affise_event_data": {

"affise_event_custom_id_01": "AiChatClickEvent",

"affise_event_custom_id_{01}_timestamp": 1685449930539

},

"affise_parameters": {}

},

{

"affise_event_id": "b1e1aa62-652e-48d5-a9b0-4f9a0b9448e0",

"affise_event_name": "CustomId10",

"affise_event_category": "native",

"affise_event_timestamp": 1685449935544,

"affise_event_first_for_user": false,

"affise_event_user_data": "about:blank",

"affise_event_data": {

"affise_event_custom_id_10": "PageFinishedLoading",

"affise_event_custom_id_{10}_timestamp": 1685449935544

},

"affise_parameters": {}

}

],

"affise_internal_events_count": 0,

"internal_events": [],

"affise_sdk_events_count": 0,

"sdk_events": [],

"affise_metrics_events_count": 0,

"metrics_events": []

}

]

Provider affise_app_token

affise_app_token = SHA256(affiseAppId + createdTime + secretId)

where:

  • affiseAppId - Affise application Id.

  • createdTime - time of request.

  • secretId - SDK Secret Key.

fun sha256(value: String) : String {

return MessageDigest.getInstance("SHA-256")

.digest(value.toByteArray())

.joinToString("") {

"%02x".format(it)

}

}

Example:

affiseAppId

AffiseDemoApp

createdTime

1685463568000

secretId

be07d122-3f3c-11ec-9bbc-0242ac130002

SHA256

00c1c31859fcfecc7be3a4505d27bc189e6deebd544025ddd1017b770407974e

Google Play referral library integration

To get a referral correctly, it's necessary to integrate with the Google library. Read how to do that here.


Please contact the Affise Customer Support team regarding all raised questions via the e-mail: [email protected].

Did this answer your question?