Skip to content

add_event and the SDK

POST /v1/external_data/add_event and add_simple_event take installs and in-app events sent by your server instead of (or in addition to) the SDK. Client API key only.

One request is one device and at most one in-app event.

  1. Device. Looked up by the first identifier set: affise_device_id + random_user_id, gaid_adid, adid (idfa), idfv, click_id, pub_click_id. At least one is required (or gen_from_click with ip). Identifiers are UUIDs.
  2. New install. Created when no install is found and the request has app_id and a non-zero first_open_time. Attribution: click_id / pub_click_id, the install referrer, probabilistic by ip / ips, then partner_id (or partner_name with partner_upsert). A new random_user_id of a known affise_device_id is a reinstall. A request without an event only creates (or updates) the install; an Install event sent with a new install is not duplicated.
  3. Event. Published when event.affise_event_name is set; affise_event_category is always external. If the application has a list of allowed API events, other names are rejected.
  4. Environment. sandbox: true or an identifier from the dev list of the application marks the install and its events as sandbox; a sandbox install keeps it for all later events.

Answer: 200 {"request_id": "..."}; a rejected request — 400 {"error": {"text": "..."}, "request_id": "..."}.

FieldValue
received_at, created_at, updated_atthe time the request was received
affise_event_timestampevent.affise_event_timestamp of the request: unix seconds, milliseconds or microseconds, detected by magnitude; 0 — the time of the request; more than 5 minutes in the future — 400 event from future
created_timeequal to affise_event_timestamp
first_open_timefirst_open_time of the request (seconds or milliseconds); 0 — the time of the click found by gen_from_click, or the time of the request for a reinstall; not checked for the future

What the fields mean: Time.

The same as add_event for callers that can only send flat key-value pairs (a postback URL of a network): query parameters and/or a flat JSON object. Keys are case-insensitive, prefixes event. and affise_parameters. are dropped.

Keyadd_event field
affise_device_id, device_idaffise_device_id
random_user_id, click_id, pub_click_id, app_id, first_open_time, idfv, referrer, ip, country, app_version, affise_sdk_version, os_version, platform, api_level_os, os_name, sdk_platform, device_name, language, timezone_devthe same
partner_id, pidpartner_id
advertising_id, advertiser_id, advertisergaid_adid and adid
gaid_adid, gaidgaid_adid
adid, idfaadid
affise_event_name, event_name, eventevent.affise_event_name
ua, user_agentua
gen, gen_from_clickgen_from_click (true / 1)
advertiser_tracking_enabled, application_tracking_enabledthe same (true / 1)
affise_p_*, p_*event parameters

The time of the event is always the time of the request: affise_event_timestamp cannot be passed.

SDK postbackadd_event
Source authenticationsignature of the application packageclient API key
Event in the future (> 5 min)affise_event_timestamp replaced by received_atrequest rejected, 400
first_open_time in the futurereplaced by received_attaken as sent
first_open_time emptyreceived_atno new install (except gen_from_click and a reinstall)
created_timeinstall: received_at; event: time from the SDKaffise_event_timestamp
Events per requestseveralone
affise_event_categoryfrom the SDKalways external
Allowed events of the applicationSDK listAPI list
Device lookupaffise_device_id + random_user_idalso by gaid_adid, adid, idfv, click_id, pub_click_id
Sessionsfrom the SDKone session at the new install
Ad revenue eventssent to the ad revenue dataregular in-app events
Fraud checksyesno