Jump to: Adjustment Events Stream | How to Reconcile the Events Stream with the Adjustment Events Stream | Example adjustment outputs: | Creating new Conversions via API | Updating an existing Conversion | Field Updates | Handling Event Deduplication
Adjustment Events Stream
The adjustment events stream is a combination of:
- New events created through the Network API
- New events created by the Conversion Upload tool
- Events and adjustments to existing conversions through the Network API or Conversion Upload tool.
The Adjustment Events stream needs to be included to properly reconcile statistics and update existing conversions with Firehose.
How to Reconcile the Events Stream with the Adjustment Events Stream
First, the adjust_action value will need to be examined in order to determine the proper Adjustment Event action approach.
If adjust_action = 1 (create): Append the adjustment event to the regular event stream
If adjust_action = 2 (update): These events serve as a ledger of changes to the original event. The event identified via the TUNE Event ID value in the adjustment record will need to be applied to the event record with the same TUNE Event ID value. The TUNE Event ID serves as our primary/unique key for all event records.
Example adjustment outputs:
Creating new Conversions via API
{""action"": ""conversion"",
""ad_campaign_creative_id"": 0,
""ad_campaign_id"": 0,
""adjust_action"": ""create"",
""adjustment_sequence_id"": 16648208123366,
""adjustment_timestamp"": 1664820812,
""adv_sub"": """",
""adv_unique1"": """",
""adv_unique2"": """",
""adv_unique3"": """",
""adv_unique4"": """",
""adv_unique5"": """",
""advertiser_id"": 0,
""advertiser_manager_id"": ""0"",
""aff_sub"": """",
""aff_sub2"": """",
""aff_sub3"": """",
""aff_sub4"": """",
""aff_sub5"": """",
""affiliate_click_id"": """",
""affiliate_id"": 1029,
""affiliate_manager_id"": 1,
""affiliate_unique1"": """",
""affiliate_unique2"": """",
""affiliate_unique3"": """",
""affiliate_unique4"": """",
""affiliate_unique5"": """",
""app_version"": """",
""browser_id"": 0,
""conversion_id"": 923242,
""country_code"": ""INT"",
""created_from_adjustment"": true,
""created_timestamp"": 1664810032,
""creative_url_id"": 0,
""currency"": ""EUR"",
""current_payout"": 1.0,
""current_revenue"": 2.0,
""customer_id"": 0,
""date"": ""2022-10-03"",
""datetime"": ""2022-10-03 11:13:52"",
""event_id"": ""a6f0653c-ace9-4e63-bfaf-8c953d30fb99"",
""goal_id"": 0,
""hour"": 11,
""ip"": """",
""network_id"": ""demo"",
""num"": 1,
""offer_file_id"": 0,
""offer_id"": 1,
""order_id"": """",
""payout"": 1.0,
""payout_cents"": 1.0,
""payout_type"": ""cpa_flat"",
""pixel_refer"": """",
""product_category"": """",
""promo_code"": """",
""refer"": """",
""revenue"": 2.0,
""revenue_cents"": 2.0,
""revenue_type"": ""cpa_flat"",
""sale_amount"": 0.0,
""sale_cents"": 0.0,
""session_datetime"": """",
""session_ip"": """",
""sku_id"": """",
""source"": """",
""status"": ""approved"",
""status_code"": 52,
""timezone"": ""America/New_York"",
""transaction_id"": """",
""tune_event_id"": ""adc6c18f-5d50-4a0f-a8cc-ff63f06b6336"",
""update_stats"": true,
""user_agent"": """"}
Updating an existing Conversion
{
"""action""":"""conversion""",
"""ad_campaign_creative_id""":0,
"""ad_campaign_id""":0,
"""adjust_action""":"""update""",
"""adjustment_sequence_id""":16648209853209,
"""adjustment_timestamp""":1664820985,
"""adv_sub""":"""",
"""advertiser_id""":0,
"""advertiser_manager_id""":""1"",
"""aff_sub""":"""",
""aff_sub2"":"""",
""aff_sub3"":"""",
""aff_sub4"":"""",
""aff_sub5"":"""",
"""affiliate_id""":1029,
"""affiliate_manager_id""":0,
"""browser_id""":7,
"""conversion_id""":329536393,
"""country_code""":"""UK""",
"""created_from_adjustment""":false,
"""created_timestamp""":1664820662,
"""creative_url_id""":0,
"""currency""":"""USD""",
"""current_payout""":7.0,
"""current_revenue""":0.0,
"""current_sale_amount""":0.0,
"""customer_id""":0,
"""date""":""2022-10-03"",
"""datetime""":"""2022-10-03 14":"11":02"",
"""event_id""":""e9cf2e32-3024-46a1-a089-bb56967f83aa"",
"""goal_id""":0,
"""hour""":14,
"""ip""":""10.1.1.10"",
"""network_id""":"""demo""",
"""offer_file_id""":0,
"""offer_id""":1,
"""payout""":0.0,
"""payout_cents""":0.0,
"""payout_type""":"""cpa_flat""",
"""pixel_refer""":"""https":"",
"""promo_code""":"""",
"""refer""":"""",
"""revenue""":0.0,
"""revenue_cents""":0.0,
"""revenue_type""":"""cpa_flat""",
"""sale_amount""":0.0,
"""sale_cents""":0.0,
"""session_datetime""":"""2022-10-03 14":"08":34"",
"""session_ip""":""10.1.1.2"",
"""source""":"""",
"""status""":"""rejected""",
"""status_code""":12,
"""timezone""":"""America/New_York""",
"""transaction_id""":""102dab988204e09a8a6fd048f5c480"",
"""tune_event_id""":""455226b0-e485-4284-9853-4c152dbdece6"",
"""update_stats""":false,
"""user_agent""":""Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML,
like Gecko) Mobile/15E148""
}
Field Updates
Updates to existing events allow a subset of fields to be modified. These fields will need to either be updated on the original event record or a window function must be used to take the latest adjustment_sequence_id field. The value of the adjustment_sequence_id field can also order the adjustment ledger for each TUNE Event ID.
*The TUNE Event ID is the unique conversion identifier used by TUNE. This ID will need to be included along with the adjustment stream to update existing conversions in the 3rd party destination location.
Handling Event Deduplication
Each tracking event has an alphanumeric identifier, event_id. Use this value for deduplication purposes. Do not use the dispatch_id in the message envelope for deduplication.
The value of event_id is guaranteed to be unique only within a given network. If developing code to work with multiple networks, you must validate against network_id in conjunction with event_id.