### Start Trial Event Tracking (C++)
Source: https://help.airbridge.io/en/developers/unreal-sdk-v4
Tracks the initiation of a user trial for a service or product. This event includes a transaction ID, currency, the trial period (e.g., 'P1M' for one month), and details of the product associated with the trial.
```c
FAirbridge::TrackEvent(
AirbridgeCategory::START_TRIAL,
UAirbridgeMap::CreateObject()
->Set(AirbridgeAttribute::TRANSACTION_ID, "ef1e5271-0370-407c-b1e9-669a8df1dc2c")
->Set(AirbridgeAttribute::CURRENCY, "USD")
->Set(AirbridgeAttribute::PERIOD, "P1M")
->Set(AirbridgeAttribute::PRODUCTS,
UAirbridgeList::CreateObject()
->Add(
UAirbridgeMap::CreateObject()
->Set(AirbridgeAttribute::PRODUCT_ID, "306a57cb-f653-4220-a208-8405d8e4d506")
->Set(AirbridgeAttribute::PRODUCT_NAME, "MusicStreamingMembership")
->Set(AirbridgeAttribute::PRODUCT_PRICE, 15)
->Set(AirbridgeAttribute::PRODUCT_CURRENCY, "USD")
)
)
);
```
--------------------------------
### Create Tracking Links Launching App or Redirecting to App Store
Source: https://help.airbridge.io/en/developers/unreal-sdk-v4
Demonstrates creating a tracking link using `FAirbridge::CreateTrackingLink`. This example configures the link to open a specific app scheme or redirect to the app store for iOS and Android, and a fallback webpage for desktop. It utilizes `OnSuccess` and `OnError` callbacks.
```c++
FAirbridge::CreateTrackingLink(
TEXT("test_channel"),
UAirbridgeMap::CreateObject()
->Set(AirbridgeTrackingLinkOption::CAMPAIGN, TEXT("test_campaign"))
->Set(AirbridgeTrackingLinkOption::DEEPLINK_URL, TEXT("YOUR_SCHEME://..."))
->Set(AirbridgeTrackingLinkOption::FALLBACK_IOS, TEXT("store"))
->Set(AirbridgeTrackingLinkOption::FALLBACK_ANDROID, TEXT("store"))
->Set(AirbridgeTrackingLinkOption::FALLBACK_DESKTOP, TEXT("https://example.com/")),
[](const FAirbridgeTrackingLink& TrackingLink)
{
},
[](const FString& Error)
{
}
);
```
--------------------------------
### Track Complete Tutorial Event in C++
Source: https://help.airbridge.io/en/developers/unreal-sdk-v4
Tracks the completion of a tutorial by the user, including an optional description. This helps in understanding user onboarding progress.
```c++
FAirbridge::TrackEvent(
AirbridgeCategory::COMPLETE_TUTORIAL,
UAirbridgeMap::CreateObject()
->Set(AirbridgeAttribute::DESCRIPTION, "Finish Initial Tutorial")
);
```
--------------------------------
### Create Tracking Links Redirecting to Webpage Only
Source: https://help.airbridge.io/en/developers/unreal-sdk-v4
Provides an example of creating a tracking link that redirects users solely to a webpage for iOS, Android, and Desktop. This configuration is useful when app-specific fallbacks are not required.
```c++
FAirbridge::CreateTrackingLink(
TEXT("test_channel"),
UAirbridgeMap::CreateObject()
->Set(AirbridgeTrackingLinkOption::CAMPAIGN, TEXT("test_campaign"))
->Set(AirbridgeTrackingLinkOption::FALLBACK_IOS, TEXT("https://example.com/")),
->Set(AirbridgeTrackingLinkOption::FALLBACK_ANDROID, TEXT("https://example.com/")),
->Set(AirbridgeTrackingLinkOption::FALLBACK_DESKTOP, TEXT("https://example.com/")),
[](const FAirbridgeTrackingLink& TrackingLink)
{
},
[](const FString& Error)
{
}
);
```
--------------------------------
### Install Airbridge iOS SDK with CocoaPods
Source: https://help.airbridge.io/en/deeplink-developers/sdk-quickstart
This snippet guides users on installing the Airbridge iOS SDK using CocoaPods. It includes commands for installing CocoaPods, initializing a Podfile, and adding the SDK as a dependency. Ensure 'User Script Sandboxing' is set to 'No' in Xcode build settings.
```shell
brew install cocoapods
pod init
pod install --repo-update
```
```ruby
target '[Project Name]' do
...
# Replace $HERE_LATEST_VERSION with latest version
# - Versions: https://help.airbridge.io/developers/release-note-ios-sdk
# - Example: pod 'airbridge-ios-sdk', '4.X.X'
pod 'airbridge-ios-sdk', '$HERE_LATEST_VERSION'
...
end
```
--------------------------------
### Setup Deep Linking for Web SDK
Source: https://help.airbridge.io/en/developers/sdk-quickstart
Configures deep linking to redirect users from your website to your application. It specifies different destinations for users with and without the app installed, and provides fallback options.
```javascript
airbridge.openDeeplink({
deeplinks: {
ios: 'example://detail?id=1',
android: 'example://detail?id=1',
desktop: 'https://example.com/detail?id=1'
},
fallbacks: {
ios: 'itunes-appstore', // or 'https://example.com'
android: 'google-play' // or 'https://example.com'
}
})
```
--------------------------------
### Start Tracking (C++)
Source: https://help.airbridge.io/en/developers/unreal-sdk-v4
Initiates event tracking in the Airbridge SDK. This function should be called when user consent is obtained and tracking is desired, typically after disabling 'Auto Start Tracking'.
```c
FAirbridge::StartTracking();
```
--------------------------------
### Install Airbridge Web SDK via Script Tag
Source: https://help.airbridge.io/en/developers/sdk-quickstart
Installs the Airbridge Web SDK by adding a script tag to the HTML's head section. This method automatically makes the `airbridge` object available globally.
```html
```
--------------------------------
### Install Airbridge Web SDK via yarn
Source: https://help.airbridge.io/en/developers/sdk-quickstart
Installs the Airbridge Web SDK using yarn. After installation, the SDK can be imported into your JavaScript modules.
```bash
yarn add airbridge-web-sdk-loader
```
--------------------------------
### Stop Tracking (C++)
Source: https://help.airbridge.io/en/developers/unreal-sdk-v4
Halts event tracking in the Airbridge SDK. This function is used to stop collecting events, usually when tracking is no longer needed or explicitly declined by the user, and typically after enabling 'Auto Start Tracking'.
```c
FAirbridge::StopTracking();
```
--------------------------------
### Install Airbridge Web SDK via npm
Source: https://help.airbridge.io/en/developers/sdk-quickstart
Installs the Airbridge Web SDK using npm. After installation, the SDK can be imported into your JavaScript modules.
```bash
npm install airbridge-web-sdk-loader
```
--------------------------------
### Example Postback URL with Sample Data
Source: https://help.airbridge.io/en/guides/airbridge-partner-registration
Provides a concrete example of a postback URL with sample data populated for the macros. This illustrates how the URL appears after Airbridge has replaced the macros with specific event and attribution details.
```text
https://api.example-ad-channel.com/postback/airbridge?touchpoint_id=e7580180-7f04-11e6-bdf4-0800200c9a66&ad_channel=sample_channel&event_timestamp=1479186394000&customID=4093721
```
--------------------------------
### Install Airbridge Web SDK via pnpm
Source: https://help.airbridge.io/en/developers/sdk-quickstart
Installs the Airbridge Web SDK using pnpm. After installation, the SDK can be imported into your JavaScript modules.
```bash
pnpm install airbridge-web-sdk-loader
```
--------------------------------
### TrackEvent Function
Source: https://help.airbridge.io/en/developers/unreal-sdk-v4
This section details the `Airbridge.TrackEvent` function used to send events from your application. It outlines the parameters, their types, and their requirements.
```APIDOC
## POST /trackEvent
### Description
Sends an in-app event with optional semantic and custom attributes.
### Method
POST
### Endpoint
`/trackEvent`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **category** (String) - Required - The name or category of the event.
- **semanticAttributes** (UAirbridgeMap) - Optional - Predefined attributes by Airbridge for reporting and analysis.
- **customAttributes** (UAirbridgeMap) - Optional - User-defined attributes for custom tracking.
### Request Example
```json
{
"category": "airbridge.ecommerce.order.completed",
"semanticAttributes": {
"action": "Tool",
"label": "Hammer",
"value": 10,
"currency": "USD",
"products": [
{
"product_id": 12345
}
],
"totalQuantity": 1
},
"customAttributes": {
"promotion": "FirstPurchasePromotion"
}
}
```
### Response
#### Success Response (200)
Indicates the event was successfully queued for tracking.
#### Response Example
```json
{
"status": "success",
"message": "Event queued for tracking"
}
```
```
--------------------------------
### Track Tutorial Completion with Airbridge SDK
Source: https://help.airbridge.io/en/developers/android-sdk-v4
This example shows how to track the completion of a tutorial using the Airbridge SDK. It requires the 'COMPLETE_TUTORIAL' category and an optional description of the tutorial. The event data is passed as a map.
```kotlin
Airbridge.trackEvent(
AirbridgeCategory.COMPLETE_TUTORIAL,
mapOf(
AirbridgeAttribute.DESCRIPTION to "Finish Initial Tutorial",
)
)
```
```java
Airbridge.trackEvent(
AirbridgeCategory.COMPLETE_TUTORIAL,
new HashMap() {{
put(AirbridgeAttribute.DESCRIPTION, "Finish Initial Tutorial");
}}
);
```
--------------------------------
### Get Huawei Install Referrer Details - Android SDK
Source: https://help.airbridge.io/en/developers/fetching-guide-for-android-sdk
Retrieves Huawei install referrer details using the Airbridge SDK. This function is asynchronous and provides results via a callback. It requires the Airbridge SDK to be initialized.
```kotlin
import co.ab180.airbridge.Airbridge
import co.ab180.airbridge.AirbridgeCallback
import co.ab180.airbridge.ReferrerDetails
Airbridge.getDeviceInfo().getHuaweiInstallReferrerDetails(object : AirbridgeCallback {
override fun onSuccess(result: ReferrerDetails?) {
}
override fun onFailure(throwable: Throwable) {
}
override fun onComplete() {
}
})
```
```java
import co.ab180.airbridge.Airbridge;
import co.ab180.airbridge.AirbridgeCallback;
import co.ab180.airbridge.ReferrerDetails;
Airbridge.getDeviceInfo().getHuaweiInstallReferrerDetails(new AirbridgeCallback.SimpleCallback() {
@Override
public void onSuccess(ReferrerDetails details) {
}
@Override
public void onFailure(Throwable throwable) {
}
});
```
--------------------------------
### Set and Manage User Information in C++
Source: https://help.airbridge.io/en/developers/unreal-sdk-v4
This C++ code snippet demonstrates how to set and manage user information using the Airbridge SDK. It includes examples for setting user email and phone numbers (which are automatically hashed), adding and removing custom user attributes, and clearing all user attributes. Ensure the Airbridge SDK is correctly integrated into your project.
```cpp
// Automatically hashed on client side using SHA256
// Can turn off hashing feature with special flag
FAirbridge::SetUserEmail("testID@ab180.co");
FAirbridge::SetUserPhone("821012341234");
// Attributes
FAirbridge::SetUserAttribute("ADD_YOUR_KEY", 1);
FAirbridge::SetUserAttribute("ADD_YOUR_KEY", 1L);
FAirbridge::SetUserAttribute("ADD_YOUR_KEY", 1f);
FAirbridge::SetUserAttribute("ADD_YOUR_KEY", 1.0);
FAirbridge::SetUserAttribute("ADD_YOUR_KEY", "1");
FAirbridge::SetUserAttribute("ADD_YOUR_KEY", true);
FAirbridge::RemoveUserAttribute("DELETE_THIS_KEY");
FAirbridge::ClearUserAttributes();
```
--------------------------------
### Track Start Trial Event in C#
Source: https://help.airbridge.io/en/developers/unity-sdk-v4
This C# code snippet shows how to track a 'Start Trial' event using the Airbridge SDK. It includes transaction ID, currency, trial period, and product details. Ensure the Airbridge SDK is initialized before use.
```csharp
Airbridge.TrackEvent(
category: AirbridgeCategory.START_TRIAL,
semanticAttributes: new Dictionary()
{
{ AirbridgeAttribute.TRANSACTION_ID, "ef1e5271-0370-407c-b1e9-669a8df1dc2c" },
{ AirbridgeAttribute.CURRENCY, "USD" },
{ AirbridgeAttribute.PERIOD, "P1M" },
{
AirbridgeAttribute.PRODUCTS, new List