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.
add_event
Section titled “add_event”One request is one device and at most one in-app event.
- 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 (orgen_from_clickwithip). Identifiers are UUIDs. - New install. Created when no install is found and the request has
app_idand a non-zerofirst_open_time. Attribution:click_id/pub_click_id, the install referrer, probabilistic byip/ips, thenpartner_id(orpartner_namewithpartner_upsert). A newrandom_user_idof a knownaffise_device_idis a reinstall. A request without an event only creates (or updates) the install; anInstallevent sent with a new install is not duplicated. - Event. Published when
event.affise_event_nameis set;affise_event_categoryis alwaysexternal. If the application has a list of allowed API events, other names are rejected. - Environment.
sandbox: trueor an identifier from the dev list of the application marks the install and its events assandbox; a sandbox install keeps it for all later events.
Answer: 200 {"request_id": "..."}; a rejected request — 400 {"error": {"text": "..."}, "request_id": "..."}.
Time fields of add_event
Section titled “Time fields of add_event”| Field | Value |
|---|---|
received_at, created_at, updated_at | the time the request was received |
affise_event_timestamp | event.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_time | equal to affise_event_timestamp |
first_open_time | first_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.
add_simple_event
Section titled “add_simple_event”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.
| Key | add_event field |
|---|---|
affise_device_id, device_id | affise_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_dev | the same |
partner_id, pid | partner_id |
advertising_id, advertiser_id, advertiser | gaid_adid and adid |
gaid_adid, gaid | gaid_adid |
adid, idfa | adid |
affise_event_name, event_name, event | event.affise_event_name |
ua, user_agent | ua |
gen, gen_from_click | gen_from_click (true / 1) |
advertiser_tracking_enabled, application_tracking_enabled | the 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.
add_event compared to the SDK
Section titled “add_event compared to the SDK”| SDK postback | add_event | |
|---|---|---|
| Source authentication | signature of the application package | client API key |
| Event in the future (> 5 min) | affise_event_timestamp replaced by received_at | request rejected, 400 |
first_open_time in the future | replaced by received_at | taken as sent |
first_open_time empty | received_at | no new install (except gen_from_click and a reinstall) |
created_time | install: received_at; event: time from the SDK | affise_event_timestamp |
| Events per request | several | one |
affise_event_category | from the SDK | always external |
| Allowed events of the application | SDK list | API list |
| Device lookup | affise_device_id + random_user_id | also by gaid_adid, adid, idfv, click_id, pub_click_id |
| Sessions | from the SDK | one session at the new install |
| Ad revenue events | sent to the ad revenue data | regular in-app events |
| Fraud checks | yes | no |