Install SDK
Install the Airbridge Web SDK using one of the methods below.Load from the browser directly
Load from the browser directly
<head> section.Install using the package manager
Install using the package manager
airbridge-web-sdk-loader.airbridge-web-sdk-loader package, you can refer to the code below.app and webToken can be found in the Airbridge dashboard under Settings → Tokens.Supported browser
The Airbridge Web SDK works on all browsers that support ES5.SDK initialization
Initialize the Airbridge Web SDK using theairbridge.init() function. The app and webToken values required for initialization can be found in the Airbridge dashboard under Settings → Tokens. Additional initialization options can be configured as needed.
The following is the type definition for the initialization settings.
Verify Installation
Navigate to the page where the Airbridge Web SDK is installed, open the developer tools, and run the following code.true is printed after running the code above, the SDK has been installed and initialized successfully.
airbridge.isSDKEnabled is initially false. It changes to true once the Web SDK is fully loaded and initialized successfully.Depending on the network environment, loading may be delayed, and if checked before loading is complete, false may be returned.false is being printed due to network delay, run the code below in the developer tools to check the value after 5 seconds.
Opt-in setup
autoStartTrackingEnabled to false, call the startTracking function at the point where you can collect events. When the startTracking function is called, the SDK will start collecting events.
The default setting is true.
- Prevent automatic event tracking after initialization through the
autoStartTrackingEnabled.
- Collect user responses to the collection and use of personal information. If the user agrees to the collection and use of personal information, start tracking events.
Opt-out setup
autoStartTrackingEnabled option to true, call the stopTracking function at the point where you can no longer collect events. When the stopTracking function is called, the SDK will stop collecting events.
- Enable automatic event tracking after initialization through the
autoStartTrackingEnabled. Since the default value of theautoStartTrackingEnabledoption is true, events are tracked automatically event if this setting is omitted.
- Collect user responses to the collection and use of personal information. If the user refuses the collection and use of personal information, stop tracking events.
Web Event
The Airbridge Web SDK collects user actions from the app as per settings and sends them as in-app events.Send web events
Use theairbridge.events.send function to send events.
Refer to the example below.
Event Category
Event Category
Attributes
Attributes
action,label: Collect information that can be used as GroupBys in the Airbridge reports.value: Collect information that can be used for sales analysis. Airbridge can perform calculations using the collected data.- Semantic Attribute: Collect predefined attributes by Airbridge.
- Custom Attribute: Collect attributes defined by Airbridge users.
Additional web event settings
Device identifier setup
Device identifier setup
Example codes
Airbridge collects in-app events that are classified as Standard Events and Custom Events. Standard Events. are events predefined by Airbridge. Refer to the example codes below.Sign-up, Sign-in, Sign-out, Home Screen, Product Catalog
Sign-up, Sign-in, Sign-out, Home Screen, Product Catalog
Search Results, Product View, Add Payment Info, Add to Wishlist, Add to Cart
Search Results, Product View, Add Payment Info, Add to Wishlist, Add to Cart
Initiate Checkout, Order Complete, Order Cancel, Start Trial, Subscribe, Unsubscribe
Initiate Checkout, Order Complete, Order Cancel, Start Trial, Subscribe, Unsubscribe
transactionID of the Order Cancel event into the transactionID field.If the transactionID values don’t match, the Order Cancel event won’t be processed properly.For more details, refer to the Collecting Order Cancel Events for Accurate Sales Performance Measurement.Ad Impression, Ad Click, Complete Tutorial, Achieve Level, Unlock Achievement
Ad Impression, Ad Click, Complete Tutorial, Achieve Level, Unlock Achievement
User Data
Set up User ID
User IDs refer to the user identifier used in a service. User IDs should be unique IDs that can unique users across websites and apps. The user data you set is stored in the browser’s local storage and will be included in all events until it is cleared.Set up user properties
true.
The user ID is not affected by the hash option, so if hashing is required, you must hash the user ID yourself before assigning its value.
Clear user data
Use theclearUser function to clear user data.
Web-to-app setup
You can apply theopenDeeplink function to a button on a web page to send users to the app. The function is typically used with a button, as shown below. Replace <BUTTON_ID> in the example code with the actual ID of the button that users click.
openDeeplink function.
Deep link paths (required)
Use thedeeplinks option to enter where to deep link users on each operating system and on desktop. All options are required.
deeplinks.android and deeplinks.ios, you must enter a URL scheme deep link in the appScheme://host/path format. Do not use intent scheme URLs or HTTP(S) URLs.Fallback paths (required)
Use thefallbacks option to enter the fallback path to send users to on each operating system when deep linking fails. All options are required.
'google-play' in fallbacks.android and 'itunes-appstore' in fallbacks.ios as is. If you enter any other value, the fallback does not work as expected.Type (required)
Use thetype option to enter a value depending on whether the web page has a CTA element, such as a button. This option is required.
CTA button information (recommended)
UsectaParams to enter the CTA button information to view in reports. All fields are optional. Ask your marketer for the information to enter. You can enter up to three fields per openDeeplink function. For accurate performance analysis, we recommend entering all three.
Campaign information (optional)
defaultChannel and defaultParams appears in reports when you select a touchpoint group-by.- Users click an ad that has no tracking link or UTM parameters applied
- Users enter the web landing page URL directly
defaultChannel and defaultParams to enter the campaign information to view in Airbridge reports. Ask your marketer for the information to enter. For details, see Set up campaign parameters.
Custom store page information (optional)
You can useoptions.androidStoreListing or options.iosStoreProductPage to set up a custom store page for the store fallback.
For details on custom store pages, see the official documentation (Google Play Store, Apple App Store).
options.androidStoreListing option, set fallbacks.android to "google-play". To use the options.iosStoreProductPage option, set fallbacks.ios to "itunes-appstore".Clipboard-based deferred deep linking (optional)
options.clipboardLink option is set to true, the openDeeplink function can be used for clipboard-based deferred deep linking. The default setting is false.
Clipboard-based deferred deep linking is a feature that copies the deep link and attribution data to the clipboard from the tracking link that the user clicked, reads that data from the clipboard when the user opens the app for the first time, and enables deferred deep linking with them through a deterministic approach. For more details, see Clipboard Deferred Deep Linking.
Legacy functions
openDeeplink function replaces the existing setDeeplinks, setDownloads, and sendWeb functions and can be used independently, without binding to a DOM element. The existing functions will no longer be updated in future releases. Therefore, we strongly recommend using the openDeeplink function. Refer to the information below only if you already use the existing functions.setDeeplinks function
setDeeplinks function
setDeeplinks function to deep link users to the app.setDeeplinks function, the Web SDK manages the button behavior internally, so never set an onclick function on the button. Also, do not use the id of an <a> tag.setDownloads function
setDownloads function
setDownloads function to send users to the app store, regardless of whether the app is installed.setDownloads function, the Web SDK manages the button behavior internally, so never set an onclick function on the button. Also, do not use the id of an <a> tag.sendWeb function
sendWeb function
sendWeb function to send users to another web page. Attribution data is passed between the web pages.Create smart app banners
You can use theopenBanner function to create a smart banner on a web page. Use the smart banner provided by Airbridge to add a banner to your web landing page. The image below shows the default smart banner format. You can change the title, description, button text, and more.

Banner information
Enter the following fields to configure the banner.Redirection information
Enter thedestination field in the banner information to set where to redirect users who click the button.
Deep link users to the app
To deep link users to the app, configure the settings as follows.
Style information
Enter thestyles field in the banner information to change the banner style. Each key should be specified using a CSS selector format. Use the id values provided by Airbridge below to specify which part of the banner to change. Each value should follow the CSSStyleDeclaration (TypeScript) format.
Additional settings
Compliance with Google DMA
To comply with the Digital Markets Act (DMA), the user consent data must be sent to Airbridge. For more information about the DMA and whether it applies to your service, refer to the Airbridge user guide.Collecting user consent data using the airbridge.setDeviceAlias function
Collecting user consent data using the airbridge.setDeviceAlias function
- Check the location of the users who launched the app. If their location is within the EEA, check whether the user consent data has been previously collected. If not, user consent data collection is not required.
- If no user consent data has been collected previously, you may collect the data using a prompt or other means. The user consent data fields that need to be collected are
adPersonalization,adUserData.
eea) to the Airbridge SDK using the airbridge.setDeviceAlias function.- After the user consent data and the user location data are sent to the Airbridge SDK, call the
startTrackingfunction.
Pass user data during initialization
You can pass user data during initialization so that all subsequent events include the user data. The user data you set is stored in the browser’s local storage and will be included in all events until it is cleared.Set up campaign parameters
When users land on your website through an ad, you can append parameters to the URL to enable web traffic attribution based on that information.Automatic UTM parameter setting
Automatic UTM parameter setting
utmParsing option is set to true, UTM-related parameters included in the URL are automatically extracted and attached to events. The default event is false.utm_source parameter. Even if the utmParsing option is set to true, other UTM parameters are ignored when the utm_source parameter is not in the URL.Replace the UTM parameter value
Replace the UTM parameter value
utmParameterValueReplaceMap option allows you to replace the values of UTM parameters collected through the utmParsing option. Supported parameters include utm_source, utm_campaign, utm_medium, utm_term, and utm_content.By using utmParameterValueReplaceMap, you can align UTM parameter values collected from various sources, making it easier to analyze data consistently in a single dashboard.utm_source in the URL is before_replace (e.g., https://www.example.com/?utm_source=before_replace), the value will be replaced with after_replace and sent with the event.Set non-UTM parameters as campaign parameters
Set non-UTM parameters as campaign parameters
urlQueryMapping option, you can include non-UTM parameters as campaign parameters and send them with events.utm_source, utm_campaign parameters and the my_sub_id parameter that is used within your service.https://www.example.com/path?utm_source=my_channel&utm_campaign=my_campaign&my_sub_id=example
sub_id_1 as my_sub_id in the Airbridge dashboard, along with utm_source and utm_parameter.channel in the urlQueryMapping option. If not, all other options are also ignored.Manually parse parameters
Manually parse parameters
init function.Set delay time to ensure event transmission
You can use theevents.wait function to ensure that all event transmissions are completed before the user navigates away.
If a page is navigated away before the events are fully transmitted, there is a risk of event data loss. For example, when transmitting event data on an intermediate page that quickly redirects, use events.wait and minimize the risk of data loss.
Edit the attribution window
You can set the attribution window in days using thecookieWindow option.
The default setting is 3 days.
cookieWindowInMinutes option. If both cookieWindow option and cookieWindowInMinutes option are configured, the cookieWindowInMinutes option takes precedence.
Set the attribution window for web-to-app attribution
You can configure the Protected Attribution Window (PAW) using theuseProtectedAttributionWindow option.
The default setting is true.
- When
useProtectedAttributionWindowis set totrue, PAW is applied. For more details, refer to the User Guide. - When
useProtectedAttributionWindowis set tofalse, PAW is not applied. For more details, refer to the User Guide.
protectedAttributionWindowInMinutes option.
The default value is 30 minutes, and it can be set up to a maximum of 3 days (4320 minutes).
This option is only enabled when useProtectedAttributionWindow is set to true.
Share attribution data across subdomains
By default, the Airbridge Web SDK stores attribution data in cookies and uses the root domain’s cookie storage. This allows attribution data to be shared across subdomains. If you’re using multiple subdomains, you can configure whether to share cookies between them using theshareCookieSubdomain option.
When shareCookieSubdomain is set to false, data will not be shared between subdomains.
The default setting is true.
- Set to
trueif you are operating a single service across multiple subdomains. - Set to
falseif you are operating different services on each subdomain.
Example scenario
Example scenario
- A user clicks a tracking link for Campaign A and lands on
https://www.airbridge.io. - The user then clicks a link on the site and is redirected to
https://blog.airbridge.io.
shareCookieSubdomain setting:truehttps://www.airbridge.io→ Attributed to Campaign Ahttps://blog.airbridge.io→ Attributed to Campaign A
falsehttps://www.airbridge.io→ Attributed to Campaign Ahttps://blog.airbridge.io→ Unattributed
https://blog.airbridge.io, and that no specific campaign parameter options were added to the init function.Attribution is determined by the internal logic of the Web SDK based on the options set in the init function.Separate storage by app
By default, the Airbridge Web SDK is designed to store attribution data for only one app per domain. When theuseStoragePerApp option is set to true, data storage is separated, allowing multiple apps using subdomains under the same root domain to manage attribution data independently.
The default setting is false.
For example, if multiple apps are used on subdomains that share the same root domain, such as a.example.com and b.example.com under example.com, you can separate the storage by enabling the useStoragePerApp option as shown below.
useStoragePerApp option, the first event triggered in each browser immediately after the change may be unattributed.Create tracking links from the web
You can create a tracking link using thecreateTrackingLink function. A tracking link is a URL created to transmit touchpoint data generated by users to Airbridge.
With tracking links, you can direct users who have viewed or clicked on an ad to a desired destination. In the Airbridge dashboard, you can use the touchpoint data collected from these tracking links to analyze which channels contributed to conversions.
Configure tracking link options
Configure tracking link options
options using the following parameters.createTrackingLink function are passed via the onSuccess callback.
Create tracking links that launch the app or redirect users to the app store
Create tracking links that launch the app or redirect users to the app store
Create tracking links that launch the app or redirect users to a webpage
Create tracking links that launch the app or redirect users to a webpage
Create tracking links that redirects users to the app store only
Create tracking links that redirects users to the app store only
Create tracking links that redirects users to a webpage only
Create tracking links that redirects users to a webpage only
Collect Moloco cookie ID
WhencollectMolocoCookieID is set to true, the SDK automatically collects the cookie ID from events driven by Moloco web campaigns, enabling campaign optimization.
Using multiple apps
By defaults, the Airbridge Web SDK is accessed via a globalairbridge object. However, certain use cases may require the use of independent SDK instances.
The Airbridge Web SDK supports the simultaneous use of multiple Airbridge apps within a single service.
You can create new, isolated instances using the createAirbridge function.
Instance creation and initialization
Creation via browser script
Creation via browser script
Creation via browser script
Creation via browser script
airbridge object and any other instances created via createAirbridge are fully isolated. This allows all SDK features, including initialization, to be managed and executed separately for each instance.