Important Note:
This article has been moved to our new Developer Center. For the latest info, please see Attribution API
In the below examples, the parameters are highlighted in purple. The values in red are what you need to replace with the parameters you are specifically interested in.
Table of Contents
IMPORTANT NOTES:
- If attribution events cannot be matched to an existing user then it is held for up to 72 hours for potential user matching. If an event is not logged for a matching user within 72 hours of receiving the attribution data, then the attribution data will be dropped. This matching is also case sensitive.
- For most of our partners, attribution is matched to Amplitude users/events via the Advertising ID (IDFA/IDFV or ADID). Therefore, you must send the Advertising ID for attribution requests and you must set the idfa, idfv, and adid fields in Amplitude as the Advertising ID.
- If you are using the iOS SDK or Android SDK to send data to Amplitude, you can enable tracking of the Advertising ID by following the instructions here. If you are using JS SDK or React Native SDK, these do not have the functionality to collect Advertising ID automatically due to Google's and Apple's privacy rules around advertising ID and web tracking. You will have to send the Advertising ID through our HTTP API endpoint so that Amplitude can match attribution data/events. See the keys in our HTTP API doc.
Differences between HTTP API and Attribution API
Request Format
Send a POST or GET request to https://api2.amplitude.com/attribution
with two request parameters:
Required Argument | Description |
---|---|
api_key |
API key from the website. 040062a5d38552315b98302ba4f2f |
event |
A request parameter representing the event which is a JSON key. |
Required Keys for the Event Argument
You must include the following keys within the event argument:
Required Key | Description |
---|---|
event_type
string |
Prefix with brackets "[YOUR COMPANY]".
"[YOUR COMPANY] Install" |
platform
string |
Either "ios" or "android".
"ios" |
idfa or idfv
string |
(required for iOS) The Identifier for Advertiser or the Identifier for Vendor.
"AEBE52E7-03EE-455A-B3C4-E57283966239" Note: For iOS devices, you can send either the IDFA or the IDFV but you must send at least one. |
adid
string |
(required for Android) The Google AdID, or Amazon Advertising ID for Amazon devices.
"AEBE52E7-03EE-455A-B3C4-E57283966239" |
Additional Keys (Optional)
It would be helpful to include the following keys within the event argument in addition to the required event_type, and platform keys.
Additional Key | Description |
---|---|
android_id
string |
(Android) The Android ID.
"AEBE52E7-03EE-455A-B3C4-E57283966239" |
user_properties
dictionary |
A dictionary of attribution properties prefixed with brackets "[YOUR COMPANY]".
{"[YOUR COMPANY] media source": "Facebook"} |
time
long |
Timestamp of the event in milliseconds since epoch.
1396381378123, will be set to the upload time by default |
Example iOS Request
curl --data 'api_key=040062a5d38552315b98302ba4f2f' --data 'event={"event_type":"[YOUR COMPANY] Install", "idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239", "user_properties": {"[YOUR COMPANY] media source": "facebook", "[YOUR COMPANY] campaign": "refer-a-friend"}, "platform": "ios"}' https://api2.amplitude.com/attribution
Example Android Request
curl --data 'api_key=040062a5d38552315b98302ba4f2f' --data 'event={"event_type":"[YOUR COMPANY] Install", "adid": "AEBE52E7-03EE-455A-B3C4-E57283966239", "user_properties": {"[YOUR COMPANY] media source": "facebook", "[YOUR COMPANY] campaign": "refer-a-friend"}, "platform": "android"}' https://api2.amplitude.com/attribution