Tracking Webview

Getting Started

The Tracking WebView SDK is a JavaScript library that allow you to create tags in your HTML pages.

For an appropriate use of the library, please follow these steps:

  • create your WebViews with the component

    • ACCWKWebView if you are working on iOS, click here
    • A4SWebView if you are working on Android, click here
  • Then, refer to our support team to establish the connection of your application to the library

Available tags

Track Event Acc.trackEvent(type, value)
Track Lead Acc.trackLead(label, value)
Track Cart Acc.trackCart(cartId, articleId, quantity, category, label, price, currency)
Track Purchase Acc.trackPurchase(purchaseId, currency, totalPrice)
Acc.trackPurchase(purchaseId, currency, totalPrice, items)
Update Device Information Acc.setUdi(key, value)
Acc.incrementUdi(key, value)
Acc.decrementUdi(key, value)
Acc.deleteUdi(key)
Set View Acc.setView(viewName)
Subscription Tag Acc.setTag(category, name, properties)
Acc.deleteTag(category, name)
Data Optin Acc.enableDataOptin()
Acc.disableDataOptin()
Geoloc Optin Acc.enableGeolocOptin()
Acc.disableGeolocOptin()
State Acc.setState(name, value)
Acc.deleteState(name)
Track Click Acc.trackClick(messageId, buttonId)
Close Webview Acc.closeWebview()

Creating your tags

TrackEvent

# option type description
1 type Number
2 value Object
Acc.trackEvent(1048, {'step_1': 'ok', 'other': 'misc'});

TrackLead

# option type description
1 label String
2 value * You can provide a 'now()' string that will create a 'YYYY-MM-DD hh:mm:ss' string date
Acc.trackLead('foo', 'bar');

TrackCart

# option type description
1 cartId String
2 articleId String
3 quantity Number
4 category String
5 label String
6 price Number
7 currency String
Acc.trackCart('124085', '80adaada-5db1-4da1-b252-027efc91d067', 1, 'shoes', 'ballerinas', 49.99, 'EUR');

TrackPurchase

Simple purchase

# option type description
1 purchaseId String
2 currency String
3 totalPrice Number As you have provided some items, you can provide a 'calculated()' string for this option that will make the sum of each price's item
4 items Array Optional, you can provide an array of items (see the format below)
// Simple purchase
Acc.trackPurchase('ae3848f8-7c1e-47b9-8f9d-25ddc4cfb938', 2000, 'EUR');

Purchase with Items:

# item option type description
1 id String
2 label String
3 price Number
4 quantity Number
5 category String
// Purchase with items
var items = [
    {'category' : 'iPhone', 'id' : '6fbf6b83-4033-4f66-88d5-3306a0310abd', 'label' : 'iPhone 7+', 'price' : 909, 'quantity' : 2},
    {'category' : 'Android', 'id' : '5a7e69f2-17c0-4b72-88fb-94c1f898d4c7', 'label' : 'Pixel 2', 'price' : 650, 'quantity' : 1}
];

Acc.trackPurchase('ae3848f8-7c1e-47b9-8f9d-25ddc4cfb938', 'EUR', 'calculated()', items);

UpdateDeviceInformation

SetUdi

# option type description
1 key String
2 value * You can provide a 'now()' string that will create a 'YYYY-MM-DD hh:mm:ss' string date
Acc.setUdi('foo', 'bar');

IncrementUdi

# option type description
1 key String
2 value Number
Acc.incrementUdi('quantity', 2);

DecrementUdi

# option type description
1 key String
2 value Number
Acc.decrementUdi('quantity', 1);

DeleteUdi

# option type description
1 key String
Acc.deleteUdi('foo');

SetView

# option type description
1 view String
Acc.setView('myView');

SubscriptionTag

SetTag

# option type description
1 category String
2 name String
3 properties Object
var item = {'color' : 'green', 'number' : 3, 'date' : new Date('December 17, 1995 03:24:00')};
Acc.setTag("Metro", "Line 3", item);

DeleteTag

# option type description
1 category String
2 name String
Acc.deleteTag("Metro", "Line 3");

State

SetState

# option type description
1 name String
2 value String
Acc.setState("station state", "closed");

DeleteState

# option type description
1 name String
Acc.deleteState("station state");