Cordova 2.X.X Migration Guide
Changes
The method used in v1.X.X has been deprecated and replaced with the following.
/**
* Send event to server.
* @param {string} category event name
* @param {EventOption} [option={}] event options
*/
trackEvent(category: string, option?: EventOption): void;
option
can be null, or it can also be used with action
, label
, value
, customAttributes
and semanticAttributes
.
Please refer to Event Setup for details.
If you were using SDK v1.X.X, please switch to trackEvent(category: string, option?: EventOption)
to track events.
User Events
Sign Up
- Airbridge.event.signUp(user, option);
+ Airbridge.state.setUser({
+ ID: ...,
+ email: ...,
+ phone: ...,
+ alias: {},
+ attributes: {},
+ });
+ Airbridge.trackEvent(AirbridgeCategory.SIGN_UP, option);
Changes need to be made if you were using Airbridge.event.signUp(user, option)
.
Instead of passing user information through the user
parameter, fill in Airbridge.state.setUser()
and forward the sign up event using Airbridge.trackEvent(AirbridgeCategory.SIGN_UP, option)
.
Sign In
- Airbridge.event.signIn(user, option);
+ Airbridge.state.setUser({
+ ID: ...,
+ email: ...,
+ phone: ...,
+ alias: {},
+ attributes: {},
+ });
- Airbridge.trackEvent(AirbridgeCategory.SIGN_IN, option);
Changes need to be made if you were using Airbridge.event.signIn(user, option)
.
Instead of passing user information through the user
parameter, fill in Airbridge.state.setUser()
and forward the sign in event using Airbridge.trackEvent(AirbridgeCategory.SIGN_IN, option)
.
Sign Out
- Airbridge.event.signOut(option);
+ Airbridge.trackEvent(AirbridgeCategory.SIGN_OUT, option);
+ Airbridge.state.setUser({});
Changes need to be made if you were using Airbridge.event.signOut(option)
.
Sign out using Airbridge.trackEvent(AirbridgeCategory.SIGN_OUT, option)
and then empty user information using Airbridge.state.setUser({})
.
E-commerce Events
E-commerce Events Documentation
View Home Screen
- Airbridge.event.viewHome(option);
+ Airbridge.trackEvent(AirbridgeCategory.HOME_VIEW, option);
Changes need to be made if you were using Airbridge.event.viewHome(option)
.
Send HOME_VIEW
events using Airbridge.trackEvent(AirbridgeCategory.HOME_VIEW, option)
.
View Product Details
- Airbridge.event.viewProductDetail(data?: {products?: Product[];}, option?: EventOption)
+ Airbridge.trackEvent(AirbridgeCategory.PRODUCT_DETAILS_VIEW, {
+ semanticAttributes: {
+ [AirbridgeAttributes.PRODUCTS]: [
+ {
+ [AirbridgeProduct.PRODUCT_ID]: 'coke_zero',
+ [AirbridgeProduct.NAME]: 'Coke Zero',
+ [AirbridgeProduct.PRICE]: 1.99,
+ [AirbridgeProduct.CURRENCY]: 'USD',
+ [AirbridgeProduct.POSITION]: 1,
+ [AirbridgeProduct.QUANTITY]: 1,
+ },
+ ]
+ }
+ });
Changes need to be made if you were using Airbridge.event.viewProductDetail(data, option)
.
Send PRODUCT_DETAILS_VIEW
events using Airbridge.trackEvent(AirbridgeCategory.PRODUCT_DETAILS_VIEW, option)
Product details should be sent under
semanticAttributes.[AirbridgeAttributes.PRODUCTS]
.
View Product List
- Airbridge.event.viewProductList(data?: {listID?: string; products?: Product[];}, option?:EventOption);
+ Airbridge.trackEvent(AirbridgeCategory.PRODUCT_LIST_VIEW, {
+ semanticAttributes: {
+ [AirbridgeAttributes.PRODUCT_LIST_ID]: 'ID-1234567890'
+ [AirbridgeAttributes.PRODUCTS]: [
+ {
+ [AirbridgeProduct.PRODUCT_ID]: 'coke_zero',
+ [AirbridgeProduct.NAME]: 'Coke Zero',
+ [AirbridgeProduct.PRICE]: 1.99,
+ [AirbridgeProduct.CURRENCY]: 'USD',
+ [AirbridgeProduct.POSITION]: 1,
+ [AirbridgeProduct.QUANTITY]: 1,
+ },
+ {
+ [AirbridgeProduct.PRODUCT_ID]: 'burger_cheese_double',
+ [AirbridgeProduct.NAME]: 'Double Cheeseburger',
+ [AirbridgeProduct.PRICE]: 3.99,
+ [AirbridgeProduct.CURRENCY]: 'USD',
+ [AirbridgeProduct.POSITION]: 2,
+ [AirbridgeProduct.QUANTITY]: 1,
+ },
+ ]
+ }
+ });
Changes need to be made if you were using Airbridge.event.viewProductList(data, option)
.
Send PRODUCT_LIST_VIEW
events using Airbridge.trackEvent(AirbridgeCategory.PRODUCT_LIST_VIEW, option)
.
Product details should be sent under
semanticAttributes.[AirbridgeAttributes.PRODUCTS]
.
Product List ID should be sent undersemanticAttributes.[AirbridgeAttributes.PRODUCT_LIST_ID]
.
View Search Result
- Airbridge.event.viewSearchResult(data?: {query?: string; products?: Product[];}, option?:EventOption)
+ Airbridge.trackEvent(AirbridgeCategory.SEARCH_RESULT_VIEW, {
+ semanticAttributes: {
+ [AirbridgeAttributes.QUERY]: 'product'
+ [AirbridgeAttributes.PRODUCTS]: [
+ {
+ [AirbridgeProduct.PRODUCT_ID]: 'coke_zero',
+ [AirbridgeProduct.NAME]: 'Coke Zero',
+ [AirbridgeProduct.PRICE]: 1.99,
+ [AirbridgeProduct.CURRENCY]: 'USD',
+ [AirbridgeProduct.POSITION]: 1,
+ [AirbridgeProduct.QUANTITY]: 1,
+ },
+ {
+ [AirbridgeProduct.PRODUCT_ID]: 'burger_cheese_double',
+ [AirbridgeProduct.NAME]: 'Double Cheeseburger',
+ [AirbridgeProduct.PRICE]: 3.99,
+ [AirbridgeProduct.CURRENCY]: 'USD',
+ [AirbridgeProduct.POSITION]: 2,
+ [AirbridgeProduct.QUANTITY]: 1,
+ },
+ ]
+ }
+ });
Changes need to be made if you were using Airbridge.event.viewSearchResult(data, option)
.
Send SEARCH_RESULT_VIEW
events using Airbridge.trackEvent(AirbridgeCategory.SEARCH_RESULT_VIEW, option)
.
Product details should be sent under
semanticAttributes.[AirbridgeAttributes.PRODUCTS]
.
Query term should be sent undersemanticAttributes.[AirbridgeAttributes.QUERY]
.
Add to Cart
- Airbridge.event.addToCart(data?: {cartID?: string; products?: Product[]; currency?: string; total?: number;}, option?: EventOption)
+ Airbridge.trackEvent(AirbridgeCategory.ADD_TO_CART, {
+ semanticAttributes: {
+ [AirbridgeAttributes.CART_ID]: 'ID-1234567890',
+ [AirbridgeAttributes.CURRENCY]: 'USD',
+ [AirbridgeAttributes.TOTAL_VALUE]: 5.98,
+ [AirbridgeAttributes.PRODUCTS]: [
+ {
+ [AirbridgeProduct.PRODUCT_ID]: 'coke_zero',
+ [AirbridgeProduct.NAME]: 'Coke Zero',
+ [AirbridgeProduct.PRICE]: 1.99,
+ [AirbridgeProduct.CURRENCY]: 'USD',
+ [AirbridgeProduct.POSITION]: 1,
+ [AirbridgeProduct.QUANTITY]: 1,
+ },
+ {
+ [AirbridgeProduct.PRODUCT_ID]: 'burger_cheese_double',
+ [AirbridgeProduct.NAME]: 'Double Cheeseburger',
+ [AirbridgeProduct.PRICE]: 3.99,
+ [AirbridgeProduct.CURRENCY]: 'USD',
+ [AirbridgeProduct.POSITION]: 2,
+ [AirbridgeProduct.QUANTITY]: 1,
+ },
+ ]
+ }
+ });
Changes need to be made if you were using Airbridge.event.addToCart(data, option)
.
Send ADD_TO_CART
events using Airbridge.trackEvent(AirbridgeCategory.ADD_TO_CART, option)
.
Product details should be sent under
semanticAttributes.[AirbridgeAttributes.PRODUCTS]
.
Cart ID should be sent undersemanticAttributes.[AirbridgeAttributes.CART_ID]
.
Currency should be sent undersemanticAttributes.[AirbridgeAttributes.CURRENCY]
.
Total value of the products should be sent undersemanticAttributes.[AirbridgeAttributes.TOTAL_VALUE]
.
Purchase
- Airbridge.event.purchase(data?: {transactionID?: string; products?: Product[]; isInAppPurchase?: boolean; currency?: string; total?: number;}, option?: EventOption)
+ Airbridge.trackEvent(AirbridgeCategory.ORDER_COMPLETED, {
+ semanticAttributes: {
+ [AirbridgeAttributes.TRANSACTION_ID]: 'transactionID-purchase',
+ [AirbridgeAttributes.CURRENCY]: 'USD',
+ [AirbridgeAttributes.TOTAL_VALUE]: 5.98,
+ [AirbridgeAttributes.IN_APP_PURCHASED]: true,
+ [AirbridgeAttributes.PRODUCTS]: [
+ {
+ [AirbridgeProduct.PRODUCT_ID]: 'coke_zero',
+ [AirbridgeProduct.NAME]: 'Coke Zero',
+ [AirbridgeProduct.PRICE]: 1.99,
+ [AirbridgeProduct.CURRENCY]: 'USD',
+ [AirbridgeProduct.POSITION]: 1,
+ [AirbridgeProduct.QUANTITY]: 1,
+ },
+ {
+ [AirbridgeProduct.PRODUCT_ID]: 'burger_cheese_double',
+ [AirbridgeProduct.NAME]: 'Double Cheeseburger',
+ [AirbridgeProduct.PRICE]: 3.99,
+ [AirbridgeProduct.CURRENCY]: 'USD',
+ [AirbridgeProduct.POSITION]: 2,
+ [AirbridgeProduct.QUANTITY]: 1,
+ },
+ ]
+ }
+ });
Changes need to be made if you were using Airbridge.event.purchase(data, option)
.
Send ORDER_COMPLETED
events using Airbridge.trackEvent(AirbridgeCategory.ORDER_COMPLETED, option)
.
Product details should be sent under
semanticAttributes.[AirbridgeAttributes.PRODUCTS]
.
Transaction ID should be sent undersemanticAttributes.[AirbridgeAttributes.TRANSACTION_ID]
.
Whether or not it was an in app purchase should be sent undersemanticAttributes.[AirbridgeAttributes.IN_APP_PURCHASED]
.
Total value of the products should be sent undersemanticAttributes.[AirbridgeAttributes.TOTAL_VALUE]
.
Custom Events
- Airbridge.event.custom(category, option)
+ Airbridge.trackEvent(category, option);
Changes need to be made if you were using Airbridge.event.custom(category, option)
.
Send custom events using Airbridge.trackEvent(category, option)
.