The options to initialize the SDK.
The name of your application.
The web token for your application.
OptionalautoStartTrackingEnabled?: booleanWhether to automatically start event tracking when the SDK is initialized.
If set to true, the SDK will automatically start event tracking when the SDK is initialized.
If set to false, you need to call the airbridge.startTracking method manually to start event tracking.
OptionalcollectMolocoCookieID?: booleanWhether to collect the Moloco cookie ID.
If set to true, the SDK will collect the Moloco cookie ID.
If set to false, the SDK will not collect the Moloco cookie ID.
OptionalcookieWindow?: numberThe window time in days for the cookie expiration.
OptionalcookieWindowInMinutes?: numberThe window time in minutes for the cookie expiration.
If set, this will override the InitializeOptions.cookieWindow option.
OptionaldefaultChannel?: stringThe default channel name for the attribution.
OptionaldefaultParams?: AttributionParametersThe default attribution parameters.
OptionalforceFirstPartyCookieID?: booleanWhether to use the first-party cookie ID instead of the third-party cookie ID for the attribution.
If set to true, the SDK will use the first-party cookie ID for the attribution.
If set to false, the SDK will use the third-party cookie ID for the attribution.
Optional ExperimentaloverwriteInstance?: booleanWhether to overwrite the existing instance of the SDK.
If set to true, the SDK will re-initialize the global instance
by replacing the existing instance with the new instance.
OptionalprotectedAttributionWindowInMinutes?: numberThe window time in minutes for the protected attribution window.
This option will be ignored if InitializeOptions.useProtectedAttributionWindow is false.
OptionalsessionTimeout?: numberThe session timeout in milliseconds.
OptionalshareCookieSubdomain?: booleanWhether to save the cookie in the subdomain.
If set to true, the SDK will save the cookie in the subdomain.
If set to false, the SDK will save the cookie in the root domain if localStorage is not available.
OptionalurlQueryMapping?: URLQueryMappingSets the mapping for the URL query parameters.
This option will be ignored if InitializeOptions.utmParsing is false.
OptionaluseProtectedAttributionWindow?: booleanWhether to use the protected attribution window.
If set to true, the SDK will parse the UTM parameters from the URL.
Optionaluser?: UserSets the user object for the attribution.
OptionaluserHash?: booleanWhether to hash the user email and phone number.
If set to true, the SDK will hash the user email and phone number when sending the event.
OptionaluseStoragePerApp?: booleanOptionalutmParameterValueReplaceMap?: UTMParameterValueReplaceMapSets the mapping for the UTM parameters.
OptionalutmParsing?: booleanWhether to parse the UTM parameters from the URL.
If set to true, the SDK will parse the UTM parameters from the URL.
Initializes the Airbridge Web SDK with the given options and calls the provided callback function.
The options to initialize the SDK.
The name of your application.
The web token for your application.
OptionalautoStartTrackingEnabled?: booleanWhether to automatically start event tracking when the SDK is initialized.
If set to true, the SDK will automatically start event tracking when the SDK is initialized.
If set to false, you need to call the airbridge.startTracking method manually to start event tracking.
OptionalcollectMolocoCookieID?: booleanWhether to collect the Moloco cookie ID.
If set to true, the SDK will collect the Moloco cookie ID.
If set to false, the SDK will not collect the Moloco cookie ID.
OptionalcookieWindow?: numberThe window time in days for the cookie expiration.
OptionalcookieWindowInMinutes?: numberThe window time in minutes for the cookie expiration.
If set, this will override the InitializeOptions.cookieWindow option.
OptionaldefaultChannel?: stringThe default channel name for the attribution.
OptionaldefaultParams?: AttributionParametersThe default attribution parameters.
OptionalforceFirstPartyCookieID?: booleanWhether to use the first-party cookie ID instead of the third-party cookie ID for the attribution.
If set to true, the SDK will use the first-party cookie ID for the attribution.
If set to false, the SDK will use the third-party cookie ID for the attribution.
Optional ExperimentaloverwriteInstance?: booleanWhether to overwrite the existing instance of the SDK.
If set to true, the SDK will re-initialize the global instance
by replacing the existing instance with the new instance.
OptionalprotectedAttributionWindowInMinutes?: numberThe window time in minutes for the protected attribution window.
This option will be ignored if InitializeOptions.useProtectedAttributionWindow is false.
OptionalsessionTimeout?: numberThe session timeout in milliseconds.
OptionalshareCookieSubdomain?: booleanWhether to save the cookie in the subdomain.
If set to true, the SDK will save the cookie in the subdomain.
If set to false, the SDK will save the cookie in the root domain if localStorage is not available.
OptionalurlQueryMapping?: URLQueryMappingSets the mapping for the URL query parameters.
This option will be ignored if InitializeOptions.utmParsing is false.
OptionaluseProtectedAttributionWindow?: booleanWhether to use the protected attribution window.
If set to true, the SDK will parse the UTM parameters from the URL.
Optionaluser?: UserSets the user object for the attribution.
OptionaluserHash?: booleanWhether to hash the user email and phone number.
If set to true, the SDK will hash the user email and phone number when sending the event.
OptionaluseStoragePerApp?: booleanOptionalutmParameterValueReplaceMap?: UTMParameterValueReplaceMapSets the mapping for the UTM parameters.
OptionalutmParsing?: booleanWhether to parse the UTM parameters from the URL.
If set to true, the SDK will parse the UTM parameters from the URL.
Callback function to be called after initialization.
Fetches the resource and calls the provided callback function with the response.
Callback function to be called with the fetched resource.
Creates a touchpoint with the given options and calls the provided callback function.
The options to create the touchpoint.
OptionaldefaultParams?: PlacementParameters["defaultParams"]OptionalctaParams?: PlacementParameters["ctaParams"]Callback function to be called after creating the touchpoint.
airbridge.createTouchpoint({
defaultParams: {
campaign: 'campaign',
medium: 'medium',
content: 'content',
term: 'term',
},
ctaParams: {
cta_param_1: 'cta_param_1',
cta_param_2: 'cta_param_2',
cta_param_3: 'cta_param_3',
},
}, (error, touchpoint) => {
if (error) {
// Handle the error
console.error('Error creating touchpoint:', error)
return
}
// Handle the created touchpoint
console.log('Created touchpoint:', touchpoint.referrer)
})
Opens the website with the URL.
The URL to open the website.
The callback function to be called with the website URL to open.
airbridge.sendWeb('https://www.example.com', (error, response) => {
if (error) {
// Handle the error
console.error('Error opening website:', error)
return
}
// Open the website with the response.targetUrl
console.log('Opening website:', response.targetUrl)
location.href = response.targetUrl
})
Sets the click event to the button element with button ID to open the store deeplink.
The options to set the store deeplink button.
The button ID(s) to add the click event.
OptionaldefaultParams?: PlacementParameters["defaultParams"]The attribution parameters.
OptionalctaParams?: PlacementParameters["ctaParams"]The CTA parameters.
Sets the click event to the button element with button ID to open the deeplink.
If options.fallbacks.ios is set to itunes-appstore, opens the store when the application is not installed.
If options.fallbacks.android is set to google-play, opens the store when the application is not installed.
The options to set the deeplink button.
The button ID(s) to add the click event.
Optionaldeeplinks?: DeeplinkOptions["deeplinks"]Optionalfallbacks?: DeeplinkOptions["fallbacks"]OptionaldefaultParams?: PlacementParameters["defaultParams"]OptionalctaParams?: PlacementParameters["ctaParams"]Optionalredirect?: booleanWhether to open the application directly without the user gesture.
If set to true, opens the application directly without the user gesture.
If set to false, opens the application after the user gesture in the click event.
OptionaldesktopPopUp?: booleanWhether to open the application in new window on desktop environment.
If set to true, opens the application in new window on desktop environment.
airbridge.setDeeplinks({
buttonID: 'open-application',
deeplinks: {
ios: 'example://main',
android: 'example://main',
desktop: 'https://www.example.com',
},
fallbacks: {
ios: 'itunes-appstore',
android: 'google-play',
},
defaultParams: {
campaign: 'campaign',
medium: 'medium',
content: 'content',
term: 'term',
},
ctaParams: {
cta_param_1: 'cta_param_1',
cta_param_2: 'cta_param_2',
cta_param_3: 'cta_param_3',
},
})
airbridge.setDeeplinks({
buttonID: 'open-application',
deeplinks: {
ios: 'https://www.example.com',
android: 'https://www.example.com',
desktop: 'https://www.example.com',
},
fallbacks: {
ios: 'itunes-appstore',
android: 'google-play',
},
defaultParams: {
campaign: 'campaign',
medium: 'medium',
content: 'content',
term: 'term',
},
ctaParams: {
cta_param_1: 'cta_param_1',
cta_param_2: 'cta_param_2',
cta_param_3: 'cta_param_3',
},
})
Opens the deeplink
The options to open the deeplink.
Determines the type of opening the deeplink.
If set to redirect, opens the application directly without the user gesture.
If set to click, opens the application after the user gesture in the click event.
Optionaldeeplinks?: DeeplinkOptions["deeplinks"]Optionalfallbacks?: DeeplinkOptions["fallbacks"]OptionaldefaultParams?: PlacementParameters["defaultParams"]OptionalctaParams?: PlacementParameters["ctaParams"]OptionaldesktopPopUp?: booleanWhether to open the application in new window on desktop environment.
If set to true, opens the application in new window on desktop environment.
airbridge.openDeeplink({
type: 'redirect',
deeplinks: {
ios: 'example://main',
android: 'example://main',
desktop: 'https://www.example.com',
},
fallbacks: {
ios: 'itunes-appstore',
android: 'google-play',
},
defaultParams: {
campaign: 'campaign',
medium: 'medium',
content: 'content',
term: 'term',
},
ctaParams: {
cta_param_1: 'cta_param_1',
cta_param_2: 'cta_param_2',
cta_param_3: 'cta_param_3',
},
})
Opens a banner with the given options.
The options for the banner.
Optionaltitle?: stringThe title of the banner.
Optionaldescription?: stringThe description of the banner.
OptionalkeyColor?: stringThe key color of the banner.
Optionalposition?: numberThe position of the banner (1 = top, 0 = bottom).
Use airbridge.openBanner() instead.
Opens a banner with the given options.
The options for the banner.
The title of the banner.
The description of the banner.
The text for the button in the banner.
The destination options for the banner (web, download, or deeplink).
Optionalcolor?: stringThe color of the banner.
Optionalposition?: "top" | "bottom"The position of the banner (top or bottom).
Optionalstyles?: Record<string, Partial<CSSStyleDeclaration>>The custom styles for the banner.
airbridge.openBanner({
title: 'Move to Website Banner',
description: 'Click the button to move to the website',
buttonText: 'Move',
color: '#0a69ff',
position: 'top',
destination: {
type: 'web',
url: 'https://www.example.com',
},
})
airbridge.openBanner({
title: 'Move to Store Banner',
description: 'Click the button to move to the store',
buttonText: 'Move',
color: '#0a69ff',
position: 'top',
destination: {
type: 'download',
defaultParams: {
campaign: 'campaign',
medium: 'medium',
content: 'content',
term: 'term',
},
ctaParams: {
cta_param_1: 'cta_param_1',
cta_param_2: 'cta_param_2',
cta_param_3: 'cta_param_3',
},
},
})
airbridge.openBanner({
title: 'Move to Application Banner',
description: 'Click the button to move to the application',
buttonText: 'Open',
color: '#0a69ff',
position: 'top',
destination: {
type: 'deeplink',
deeplinks: {
ios: 'example://main',
android: 'example://main',
desktop: 'https://www.example.com',
},
fallbacks: {
ios: 'itunes-appstore',
android: 'google-play',
},
defaultParams: {
campaign: 'campaign',
medium: 'medium',
content: 'content',
term: 'term',
},
ctaParams: {
cta_param_1: 'cta_param_1',
cta_param_2: 'cta_param_2',
cta_param_3: 'cta_param_3',
},
},
})
Creates a tracking link with the given channel and options, and calls the provided success callback.
The channel for the tracking link.
The options for the tracking link.
Optionalcampaign?: stringOptionalad_group?: stringOptionalad_creative?: stringOptionalcontent?: stringOptionalterm?: stringOptionalsub_id?: stringOptionalsub_id_1?: stringOptionalsub_id_2?: stringOptionalsub_id_3?: stringOptionaldeeplink_url?: stringOptionaldeeplink_stopover?: booleanOptionalfallback_ios?: "store" | stringOptionalfallback_android?: "store" | stringOptionalfallback_desktop?: stringOptionalfallback_ios_store_ppid?: stringOptionalfallback_android_store_listing?: stringOptionalogtag_title?: stringOptionalogtag_description?: stringOptionalogtag_image_url?: stringOptionalogtag_website_crawl?: "desktop"Optionalcustom_short_id?: stringOptionalis_reengagement?: "off" | "on_true" | "on_false"Callback function to be called with the created tracking link.
Creates a tracking link with the given channel and options, and calls the provided success and error callbacks.
The channel for the tracking link.
The options for the tracking link.
Callback function to be called with the created tracking link.
Callback function to be called with an error if one occurs.
airbridge.createTrackingLink('example', {
campaign: 'campaign',
...,
}, (trackingLink) => {
// Handle the created tracking link
console.log(trackingLink.shortURL)
window.open(trackingLink.shortURL, '_blank')
}, (error) => {
// Handle the error
console.error('Error creating tracking link:', error)
})
Initializes the Airbridge Web SDK with the given options.