Branch integration plan
Note that data generated by third-party data integration counts toward the cluster's data consumption
Summary
Interface overview
| Interface | Type | Granularity | Attribution | Cost | Revenue | Impressions | Clicks | Conversions |
|---|---|---|---|---|---|---|---|---|
| Webhooks | Callback | User level | ✅ | ✅ |
Branch provides Webhooks to send back user-level data. You can pass information such as channel attribution into AE user properties, or write the callback data as events
Before you start connecting Branch data, make sure you have read the AE system user identification rules and understand how AE identifies a user by #distinct_id and #account_id
Integration process
- Integrate the Branch SDK and the AE SDK, and set the AE system's distinct ID and account ID in the Branch SDK
- Log in to the AE backend, go to the Third-party Integration module, add a Branch Webhook callback plan, and complete the related configuration
- Configure Webhooks in the Branch dashboard and pass in the AE callback link
- Check whether the AE system receives the data successfully, and build reports
1. Client SDK reporting
If you choose to report data with the client SDK, first integrate the Branch SDK and the AE SDK into your app. Then use the Branch SDK method for setting initialization metadata parameters to set the AE system's user identification IDs (the account ID and distinct ID) in the Branch SDK. Branch's callback data then carries these ID fields, so Branch data can be associated with AE data.
1.1 Option 1 (automatic integration)
-
If you integrate the Android or iOS SDK:
- If the SDK version is 2.8.0~2.8.1, you can use this option directly
- If the SDK version is 2.8.2 or later, you also need to install the third-party data plugin. For details, see Android SDK third-party data and iOS SDK third-party data
-
If you integrate Unity SDK 2.4.0 or later, or Unreal SDK 1.5.0 or later, you can use this option directly
Note that the AE SDK must be initialized before the Branch SDK, and the code that enables automatic integration must be called immediately after the Branch SDK is initialized. Follow these steps:
- Initialize the AE SDK.
- Initialize the Branch SDK.
- Call
enableThirdPartySharingto set the distinct ID automatically.
The following are code samples for the SDK on each platform:
- Android
- iOS
- Unity
- Unreal
// 1. Initialize the Android SDK
TDConfig config = TDConfig.getInstance(this, APPID, TE_SERVER_URL);
TDAnalytics.init(config);
// 2. Initialize the Branch SDK
// ...
// 3. Call the enableThirdPartySharing API to set ta_distinct_id in Branch events
TDAnalytics.enableThirdPartySharing(TDThirdPartyType.BRANCH);
// 4. After registration or character creation, call login to set the account ID, then sync the data again (optional)
TDAnalytics.login("account_id");
TDAnalytics.enableThirdPartySharing(TDThirdPartyType.BRANCH);
// 1. Initialize the iOS SDK
TDConfig *config = [[TDConfig alloc] init];
config.appid = appid;
config.serverUrl = url;
[TDAnalytics startAnalyticsWithConfig:config];
// 2. Initialize the Branch SDK
// ...
// 3. Call the enableThirdPartySharing API to set ta_distinct_id in Branch events
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeBranch];
// 4. After registration or character creation, call login to set the account ID, then sync the data again (optional)
[TDAnalytics login:@"account_id"];
[TDAnalytics enableThirdPartySharing:TDThirdPartyTypeBranch];
// 1. Initialize the Unity SDK
TDConfig config = new TDConfig("APPID","SERVER");
TDAnalytics.Init(config);
// 2. Initialize the Branch SDK
// ...
// 3. Call enableThirdPartySharing to set ta_distinct_id in Branch events
TDAnalytics.EnableThirdPartySharing(TDThirdPartyType.BRANCH);
// 4. After registration or character creation, call login to set the account ID, then sync the data again (optional)
TDAnalytics.Login("account_id");
TDAnalytics.EnableThirdPartySharing(TDThirdPartyType.BRANCH);
// 1. Initialize the Unreal SDK
UTDAnalytics::Initialize();
// 2. Initialize the Branch SDK
// ...
// 3. Call enableThirdPartySharing to set ta_distinct_id in Branch events
TArray<FString> EventTypeList;
EventTypeList.Emplace(TEXT("TAThirdPartyShareTypeBRANCH"));
UTDAnalytics::EnableThirdPartySharing(EventTypeList, AppID);
// 4. After registration or character creation, call login to set the account ID, then sync the data again (optional)
UTDAnalytics::Login("account_id", AppID);
TArray<FString> EventTypeList;
EventTypeList.Emplace(TEXT("TAThirdPartyShareTypeBRANCH"));
UTDAnalytics::EnableThirdPartySharing(EventTypeList, AppID);
This option works by automatically calling Branch's setRequestMetadata method internally and passing in ta_distinct_id and ta_account_id.
1.2 Option 2 (manual integration)
For manual integration, you need to use the setRequestMetadata() API in the Branch SDK to set the distinct ID and account ID of the AE project.
Note that the AE SDK must be initialized before the Branch SDK. Follow these steps:
- Initialize the AE SDK.
- Initialize the Branch SDK.
- Call
setRequestMetadatato set the distinct ID.
- Android
- iOS
- Unity
// 1. Initialize the Android SDK
TDConfig config = TDConfig.getInstance(this, APPID, TE_SERVER_URL);
TDAnalytics.init(config);
// 2. Get the AE distinct ID, which corresponds to #distinct_id in AE
String distinctId = TDAnalytics.getDistinctId();
// 3. Initialize the Branch SDK
// ...
// 4. Set the distinct ID in the events collected by Branch
Branch.getInstance().setRequestMetadata("ta_distinct_id", distinctId);
// 5. After registration or character creation, call login to set the account ID, then sync the data again (optional)
String accountId = "account_id";
TDAnalytics.login(accountId);
Branch.getInstance().setRequestMetadata("ta_account_id", accountId);
// 1. Initialize the iOS SDK
TDConfig *config = [[TDConfig alloc] init];
config.appid = appid;
config.serverUrl = url;
[TDAnalytics startAnalyticsWithConfig:config];
// 2. Get the AE distinct ID, which corresponds to #distinct_id in AE
NSString *distinctId = [TDAnalytics getDistinctId];
// 3. Initialize the Branch SDK
// ...
// 4. Set the distinct ID in the events collected by Branch
[[Branch getInstance] setRequestMetadataKey:@"ta_distinct_id" value: distinctId];
// 5. After registration or character creation, call login to set the account ID, then sync the data again (optional)
NSString *accountId = @"account_id";
[TDAnalytics login:accountId];
[[Branch getInstance] setRequestMetadataKey:@"ta_account_id" value: accountId];
// 1. Initialize the Unity SDK
TDConfig config = new TDConfig("APPID","SERVER");
TDAnalytics.Init(config);
// 2. Get the AE distinct ID, which corresponds to #distinct_id in AE
var distinctId = TDAnalytics.GetDistinctId();
// 3. Initialize the Branch SDK
// ...
// 4. Set the distinct ID in the events collected by Branch
Branch.setRequestMetadata("ta_distinct_id" , distinctId);
// 5. After registration or character creation, call login to set the account ID, then sync the data again (optional)
var accountId = "account_id";
TDAnalytics.Login(accountId);
Branch.setRequestMetadata("ta_account_id" , accountId);
In Branch's Webhook callback data, ta_distinct_id and ta_account_id correspond to the distinct ID and account ID of the AE system.
Call setRequestMetadata() to set the metadata parameters immediately after the Branch SDK finishes initializing, to avoid missing metadata parameters in some Branch data. If the data still lacks the metadata parameters, or the user identification fields can't be obtained immediately after initialization, you can use Branch's Delay Session Initialization method to delay session initialization and set the metadata during the delay, so that all data carries the user identification fields.
2. Plan configuration
After completing the SDK configuration, log in to the AE system backend and configure Branch in the Third-party Integration module. The image below shows the Branch configuration page:
2.1 User identification fields
Because Branch Webhook data is user-level data, you need to set user identification rules for it, that is, the AE system's user identification IDs set in the Branch SDK. Based on this configuration, the AE system sets these fields as the user identification fields of the data when it converts the callback data.
If you configured the client SDK as described in the previous step of this document, use the following configuration:
- Field associated with the account ID: ta_account_id
- Field associated with the distinct ID: ta_distinct_id
2.2 Event Data Configuration
After you turn on the Event Data Configuration switch, all data sent back by Branch is written to the event table. We recommend that you enable event data ingestion.
2.3 User Properties Configuration
By default, the AE system automatically writes the attribution fields in Branch callback data to standardized user properties. The following are the fields written to user properties and their meanings:
| Branch field | User property name in AE | Description |
|---|---|---|
| query.channel | te_ads_object.media_source | Channel |
| query.campaign | te_ads_object.campaign_name | Campaign |
| query.ad_set_name | te_ads_object.ad_group_name | Ad group |
| query.creative_name | te_ads_object.ad_name | Ad creative |
To make changes, click Configure Rules to go to the ingestion rule configuration page, as shown below
You can change the Integration method of user properties. The default is user_setOnce, which keeps only the first reported information.
For Source Property, add the query. prefix before the ingested field name
Click the Property Mapping button to add fields to write to user properties. You can also click the Rule button on the left to add a new set of rules.
To turn off user property ingestion, stop all rules:
2.4 Configuration
In the Configuration module, you can control the detailed settings of data pulling, such as the event name after ingestion
The content of the configuration is a JSON, which you can customize as follows:
| Module | Name | Description |
|---|---|---|
| sink_event | event_mapping | Event name after ingestion; customizable. The key is the event name in Branch callback data, and the value is the event name after ingestion |
2.5 End Point
If you have configured system-level and project-level receiver URLs, the following link is shown
If no address is shown here, go to Project Settings → Settings → Implementation in the upper-right menu to configure the public network address. You can also click the TE Receiver Host URL link in the tip bar on the configuration page to go there. This address is the receiver URL configured in the AE SDK. After configuring it, return to End Point on the Branch Webhook configuration page and copy the endpoint address.
2.5.1 Custom macros
The Branch Webhook callback URL contains a structure called a macro, written as ${(macro_name)!}. You can think of a macro as a placeholder: when the data that Branch sends back contains a field that corresponds to a macro, Branch fills the value of that field in where the macro is. Taking ${(last_attributed_touch_data.~campaign)!} as an example, when Branch sends back data, it fills in the Campaign value where the macro is in the callback URL.
Replace the beginning of the following URL with the endpoint address you just obtained, and copy the resulting callback URL. You'll need to enter it in the Branch dashboard later:
https://{End Point}?branch_id=${(id)!}&campaign=${(last_attributed_touch_data.~campaign)!}&campaign_id=${(last_attributed_touch_data.~campaign_id)!}&campaign_type=${(last_attributed_touch_data.~campaign_type)!}&customer_campaign=${(last_attributed_touch_data.~customer_campaign)!}&channel=${(last_attributed_touch_data.~channel)!}&feature=${(last_attributed_touch_data.~feature)!}&stage=${(last_attributed_touch_data.~stage)!}&tags=${(last_attributed_touch_data.~tags)!}&advertising_partner_name=${(last_attributed_touch_data.~advertising_partner_name)!}&advertising_partner_id=${(last_attributed_touch_data.~advertising_partner_id)!}&secondary_publisher=${(last_attributed_touch_data.~secondary_publisher)!}&secondary_publisher_id=${(last_attributed_touch_data.~secondary_publisher_id)!}&customer_secondary_publisher=${(last_attributed_touch_data.~customer_secondary_publisher)!}&creative_name=${(last_attributed_touch_data.~creative_name)!}&creative_id=${(last_attributed_touch_data.~creative_id)!}&ad_set_name=${(last_attributed_touch_data.~ad_set_name)!}&ad_set_id=${(last_attributed_touch_data.~ad_set_id)!}&customer_ad_set_name=${(last_attributed_touch_data.~customer_ad_set_name)!}&ad_name=${(last_attributed_touch_data.~ad_name)!}&ad_id=${(last_attributed_touch_data.~ad_id)!}&customer_ad_name=${(last_attributed_touch_data.~customer_ad_name)!}&keyword=${(last_attributed_touch_data.~keyword)!}&keyword_id=${(last_attributed_touch_data.~keyword_id)!}&customer_keyword=${(last_attributed_touch_data.~customer_keyword)!}&branch_ad_format=${(last_attributed_touch_data.~branch_ad_format)!}&technology_partner=${(last_attributed_touch_data.~technology_partner)!}&banner_dimensions=${(last_attributed_touch_data.~banner_dimensions)!}&placement=${(last_attributed_touch_data.~placement)!}&placement_id=${(last_attributed_touch_data.~placement_id)!}&customer_placement=${(last_attributed_touch_data.~customer_placement)!}&sub_site_name=${(last_attributed_touch_data.~sub_site_name)!}&customer_sub_site_name=${(last_attributed_touch_data.~customer_sub_site_name)!}&agency=${(last_attributed_touch_data.~agency)!}&agency_id=${(last_attributed_touch_data.~agency_id)!}&ta_distinct_id=${(custom_data.ta_distinct_id)!}&ta_account_id=${(custom_data.ta_account_id)!}
2.6 Save the plan
After completing the configuration, click the Save button in the upper-right corner to save the plan.
3. Configure the Branch Webhook callback
After saving the plan, log in to the Branch dashboard, go to the Data Feeds page, and add a new Webhook on the WEBHOOKS tab:
Configure the Webhook link and details. You need to fill in three parts, from top to bottom and left to right:
- Send a webhook to: Enter the endpoint address you got from the AE backend, with the required custom macros added, here
- using a ...: Select the POST method
- every time users trigger the event ...: If you report with the client SDK, you can select the INSTALL event
Click Save Rule to save the rule. This completes the Branch callback configuration
Notes on install events after iOS 14.5:
When an install is attributed to a paid ad, a second install event is triggered after the user opts in to ATT
Opting in affects your final install count. We recommend that you use a different identifier (such as IDFV) to deduplicate install events in your internal systems (you can do this with the secondary development tools in the AE system).
4. Data ingestion
4.1 Event ingestion rules
-
The event_timestamp field in the data is used as the event's #event_time
-
The event name of the data comes from sink_event.event_mapping in the configuration. By default:
- Install: branch_install
- Other events not listed in sink_event.event_mapping: the
branch_prefix is added before the name field
-
All properties corresponding to the other macros in the callback URL are ingested
The following is the list of properties that Branch sends back when you use the callback URL provided in this document:
| Ingested name | Description |
|---|---|
| name | Branch event name |
| event_timestamp | Data time |
| campaign | Attributed campaign name |
| campaign_id | Attributed campaign ID |
| campaign_type | Attributed campaign type (from Google AAP attribution) |
| customer_campaign | Custom attributed campaign name |
| channel | Attributed channel name |
| feature | Attributed feature, such as "paid advertising" |
| stage | Stage |
| tags | Attributed tags |
| advertising_partner_name | Readable advertising partner name |
| advertising_partner_id | Advertising Partner ID |
| secondary_publisher | Secondary publisher name |
| secondary_publisher_id | Secondary Publisher ID |
| customer_secondary_publisher | Custom secondary publisher ID |
| creative_name | Attributed creative name |
| creative_id | Attributed creative ID |
| ad_set_name | Attributed ad set name |
| ad_set_id | Attributed ad set ID |
| customer_ad_set_name | Custom ad set name |
| ad_name | Attributed ad name |
| ad_id | Attributed ad ID |
| customer_ad_name | Custom ad name |
| keyword | Attributed keyword |
| keyword_id | Attributed keyword ID |
| customer_keyword | Custom keyword |
| branch_ad_format | Ad type, such as Search, Display, Product Ad, App only |
| technology_partner | Third-party technology partner |
| banner_dimensions | Banner dimensions |
| placement | Attributed placement |
| placement_id | Attributed placement ID |
| customer_placement | Custom placement |
| sub_site_name | Sub-site name |
| customer_sub_site_name | Custom sub-site name |
| agency | Agency name |
| agency_id | Agency ID |
| ta_distinct_id | Distinct ID of the AE system |
| ta_account_id | Account ID of the AE system |
4.2 Standardized fields
The AE system standardizes some fields in Branch Webhook callback data reports
| Original field | Standardized field | Description |
|---|---|---|
| campaign | te_ads_object.campaign_name | Campaign name |
| campaign_id | te_ads_object.campaign_id | Campaign ID |
| ad_set_name | te_ads_object.ad_group_name | Ad group name, or the Unit name for monetization ads |
| ad_set_id | te_ads_object.ad_group_id | Ad group ID, or the Unit ID for monetization ads |
| ad_name | te_ads_object.ad_name | Ad name |
| ad_id | te_ads_object.ad_id | Ad ID |
| placement | te_ads_object.placement | Ad placement |
| channel | te_ads_object.media_source | Media source |

