Skip to main content

Analytics events

An overview of the events used for analytics


When viewers interact with a page on your site, their actions trigger events. Some of these events return data that you can use to analyze and improve your users' experience.

Events

Tonos's analytics section is comprised of events that return metrics about Tonos's services. This section gives you an example of how to use each and every one of these events as well as the description to what each event does.

All the events listed below, except for the accessible event, need to be inserted into this function in order for them to work.

NOTE

Make sure to include the analytics <script> tag above the Tonos script.

javascript
function startAnalyticsEvents() {
// call the analytics events here
}

window.startAnalyticsEvents = startAnalyticsEvents;

accessible

// Insert before Tonos script tag

window.addEventListener('accessible', () => {});
EVENTDESCRIPTION
accessibleSignifies that the Tonos script is ready. This is the earliest point at which any API call should be made.

appInitialize

// Insert before Tonos script tag

tonos.on('appInitialize', (appData) => {});
EVENTDESCRIPTION
appInitializeSignifies that the Tonos script has requested data based on script value for application id, and now it can request campaigns based on this specific page.
JSON ObjectDESCRIPTION
appData JSONObject that represents the data of the event.
appData {
"ais": {
"authority": "{https://example.com/}",
"clientId": "{client_id}",
"redirectUri": "{uri}",
"responseType": "{type}",
"scopes": "{scopes}",
},
"b": 0,
"c": true
}

Information about the fields inside the appData Object are shown in the table below.

Field NameTypeDescription
aisObjectAn object that represents the application identity settings.
authoritystringThe URL of the application identity.
clientIdstringThe ID of the client.
redirectUristringContains the URI that redirects you to the login page.
responseTypestringStandard for every identity.
scopesstringStandard for every identity.
binteger($int32)BiskoId
cboolIndicates whether the client is logged in.

checkoutAbandoned

// Insert before Tonos script tag

tonos.on('checkoutAbandoned', (checkoutAbandonedData) => {});
EVENTDESCRIPTION
checkoutAbandonedTriggered when a user clicks back and abandons the checkout process.
JSON ObjectDESCRIPTION
checkoutAbandonedData JSONObject that represents the data of the event.

checkoutAbandonedData {
"oI": "{abcd}",
"papDetails": {
"description": "{description}",
"duration": "{2 Months}",
"name": "{name}",
"papId": "{1234}",
"price": "{9.99 €}",
"type": "{payment}"
}
}

Information about the fields inside the checkoutAbandonedData Object are shown in the table below.

Field NameTypeDescription
oIstringThe ID of the offer.
papDetailsObjectContains details about the product access provider.
durationstringThe duration of the product access provider.
namestringThe name of the product access provider.
papIdstringThe ID of the product access provider.
pricestringThe price of the product access provider.
typestringThe type of the product access provider.

checkoutFailed

// Insert before Tonos script tag

tonos.on('checkoutFailed', (checkoutFailedData) => {});
EVENTDESCRIPTION
checkoutFailedTriggered when the checkout process was not completed successfully
JSON ObjectDESCRIPTION
checkoutFailedData JSONObject that represents the data of the event.

checkoutFailedData {
"oI": "{abcd}",
"papDetails": {
"description": "{description}",
"duration": "{2 Months}",
"name": "{name}",
"papId": "{1234}",
"price": "{9.99 €}",
"type": "{payment}"
}
}

Information about the fields inside the checkoutFailedData Object are shown in the table below.

Field NameTypeDescription
oIstringThe ID of the offer.
papDetailsObjectContains details about the product access provider.
durationstringThe duration of the product access provider.
namestringThe name of the product access provider.
papIdstringThe ID of the product access provider.
pricestringThe price of the product access provider.
typestringThe type of the product access provider.

checkoutShow

// Insert before Tonos script tag

tonos.on('checkoutShow', (checkoutShowData) => {});
EVENTDESCRIPTION
checkoutShowTriggered when checkout is shown to the user.
JSON ObjectDESCRIPTION
checkoutShowData JSONObject that represents the data of the event.

checkoutShowData {
"oI": "{abcd}",
"papDetails": {
"description": "{description}",
"duration": "{2 Months}",
"name": "{name}",
"papId": "{1234}",
"price": "{9.99 €}",
"type": "{payment}"
}
}

Information about the fields inside the checkoutShowData Object are shown in the table below.

Field NameTypeDescription
oIstringThe ID of the offer.
papDetailsObjectContains details about the product access provider.
durationstringThe duration of the product access provider.
namestringThe name of the product access provider.
papIdstringThe ID of the product access provider.
pricestringThe price of the product access provider.
typestringThe type of the product access provider.

checkoutSuccess

// Insert before Tonos script tag

tonos.on('checkoutSuccess', (checkoutSuccessData) => {});
EVENTDESCRIPTION
checkoutSuccessTriggered when the checkout process is done successfully.
JSON ObjectDESCRIPTION
checkoutSuccessData JSONObject that represents the data of the event.

checkoutSuccessData {
"oI": "{abcd}",
"papDetails": {
"description": "{description}",
"duration": "{2 Months}",
"name": "{name}",
"papId": "{1234}",
"price": "{9.99 €}",
"type": "{payment}"
}
}

Information about the fields inside the checkoutSuccessData Object are shown in the table below.

Field NameTypeDescription
oIstringThe ID of the offer.
papDetailsObjectContains details about the product access provider.
durationstringThe duration of the product access provider.
namestringThe name of the product access provider.
papIdstringThe ID of the product access provider.
pricestringThe price of the product access provider.
typestringThe type of the product access provider.

eventTrigger

// Insert before Tonos script tag

tonos.on('eventTrigger', (eventTriggerData) => {});
EVENTDESCRIPTION
eventTriggerTriggered as soon as a campaign event is triggered.
JSON ObjectDESCRIPTION
eventTriggerData JSONObject that represents the data of the event.

eventTriggerData {
"eventType": "{eventType}"
}

Information about the fields inside the checkoutSuccessData Object are shown in the table below.

eventType Field
Field NameeventType
Typestring
DescriptionThe type of the event (Scroll, Viewport, Timer, Idle, PageView).

loginShow

// Insert before Tonos script tag

tonos.on('loginShow', (loginShowData) => {});
EVENTDESCRIPTION
loginShowTriggered when user is redirected to login screen.
JSON ObjectDESCRIPTION
loginShowData JSONObject that represents the data of the event.

loginShowData {
"tId": "{abcd}",
"cId": "{4567}",
"papDetails": {
"description": "{description}",
"duration": "{2 Months}",
"name": "{name}",
"papId": "{1234}",
"price": "{9.99 €}",
"type": "{payment}"
}
}

Information about the fields inside the loginShowData Object are shown in the table below.

Field NameTypeDescription
tIdstringThe public ID of the offer template.
cIdstringThe ID of the campaign.
papDetailsObjectContains details about the product access provider.
durationstringThe duration of the product access provider.
namestringThe name of the product access provider.
papIdstringThe ID of the product access provider.
pricestringThe price of the product access provider.
typestringThe type of the product access provider.

loginSuccess

// Insert before Tonos script tag

tonos.on('loginSuccess', (loginSuccessData) => {});
EVENTDESCRIPTION
loginSuccessTriggered when user is successfully logs in.
JSON ObjectDESCRIPTION
loginSuccessData JSONObject that represents the data of the event.

loginSuccessData {
"clId": "{abcd}",
}

Information about the fields inside the loginSuccessData Object are shown in the table below.

clId Field
Field NameclId
Typestring
DescriptionThe ID of the client.

offerClosed

// Insert before Tonos script tag

tonos.on('offerClosed', (offerClosedData) => {});
EVENTDESCRIPTION
offerClosedTriggered when an offer is closed by the user (if applicable).
JSON ObjectDESCRIPTION
offerClosedData JSONObject that represents the data of the event.

offerClosedData {
"cId": "{abcd}",
"clId": "{abcd}",
"oI": "{abcd}",
"type": "{1}",
"paps": [
{0}: {
"description": "{description}",
"duration": "{2 Months}",
"name": "{name}",
"papId": "{1234}",
"price": "{9.99 €}",
"type": "{payment}"
}
]
}

Information about the fields inside the offerClosedData Object are shown in the table below.

Field NameTypeDescription
cIdstringThe public ID of the campaign.
clIdstringThe ID of the client.
oIstringThe id of the offer.
typestringRepresents the offer type: inline or modal.
papsObjectRepresents the product access providers as an object.
descriptionstringThe description of the product access provider.
durationstringThe duration of the product access provider.
namestringThe name of the product access provider.
papIdstringThe ID of the product access provider.
pricestringThe price of the product access provider.
typestringThe type of the product access provider.

offerPlans

// Insert before Tonos script tag

tonos.on('offerPlans', (offerPlansData) => {});
EVENTDESCRIPTION
offerPlansTriggered when an offer is presented to the user.
JSON ObjectDESCRIPTION
offerPlansData JSONObject that represents the data of the event.
    "paps": [
{0}: {
"description": "{description}",
"duration": "{2 Months}",
"name": "{name}",
"papId": "{1234}",
"price": "{9.99 €}",
"type": "{payment}"
}
]
Field NameTypeDescription
papsObjectRepresents the product access providers as an object.
descriptionstringThe description of the product access provider.
durationstringThe duration of the product access provider.
namestringThe name of the product access provider.
papIdstringThe ID of the product access provider.
pricestringThe price of the product access provider.
typestringThe type of the product access provider.

offerShown

// Insert before Tonos script tag

tonos.on('offerShown', (offerData) => {});
EVENTDESCRIPTION
offerShownTriggered when an offer is presented to the user.
JSON ObjectDESCRIPTION
offerData JSONObject that represents the data of the event.

offerData {
"cId": "{abcd}",
"clId": "{abcd}",
"oI": "{abcd}",
"type": "{1}",
"paps": [
{0}: {
"description": "{description}",
"duration": "{2 Months}",
"name": "{name}",
"papId": "{1234}",
"price": "{9.99 €}",
"type": "{payment}"
}
]
}

Information about the fields inside the offerData Object are shown in the table below.

Field NameTypeDescription
cIdstringThe public ID of the campaign.
clIdstringThe ID of the client.
oIstringThe id of the offer.
typestringRepresents the offer type: inline or modal.
papsObjectRepresents the product access providers as an object.
descriptionstringThe description of the product access provider.
durationstringThe duration of the product access provider.
namestringThe name of the product access provider.
papIdstringThe ID of the product access provider.
pricestringThe price of the product access provider.
typestringThe type of the product access provider.

pageInitialize

// Insert before Tonos script tag

tonos.on('pageInitialize', (pageData) => {});
EVENTDESCRIPTION
pageInitializeSignifies that the Tonos script now has been initialized for this page and can get all campaigns that are active for this pageview.
JSON ObjectDESCRIPTION
pageData JSONObject that represents the data of the event.
pageData: {
"pc": {
{
"cid": "{abcd}",
"n": "{abcd}",
"e": [
{
"sd": 5,
"meid": "{abcd}",
"tcp": 0,
"eid": 4
}
],
"po": [
{
"tid": "{abcd}",
"t": 2,
"is": "{abcd}"
}
]
}
},
}

Information about the fields inside the pageData Object are shown in the table below.

Field NameTypeDescription
pcObjectObject that represents the campaign of the page.
cidstringThe public ID of the campaign.
nstringThe name of the campaign.
earray[Object]Array of objects that returns the trigger events.
sdinteger($int32)The seconds delay per timer, which indicates after how many seconds the offer will be showed to the user.
meidstring The ID of the media element.
tcpstringIndicates the time in seconds when the event will be triggered.
eidinteger($int32)The ID of the event.
poarray[Object]The template cards.
tidstringThe public ID of the offer template.
tstringThe type of the offer template.
isstringThe ID of the HTML element where the offer will be placed.
pinteger($int32)The ID of the page.
pidstringThe public ID of the page.

paymentShow

// Insert before Tonos script tag

tonos.on('paymentShow', (paymentShowData) => {});
EVENTDESCRIPTION
paymentShowTriggered when user is sent to payment gateway.
JSON ObjectDESCRIPTION
paymentShowData JSONObject that represents the data of the event.

paymentShowData {
"gwUrl": "{gwUrl}",
"papDetails": {
"description": "{description}",
"duration": "{2 Months}",
"name": "{name}",
"papId": "{1234}",
"price": "{9.99 €}",
"type": "{payment}"
}
}

Information about the fields inside the paymentShowData Object are shown in the table below.

Field NameTypeDescription
gwUrlstringThe URL of the GoPay product access provider.
papDetailsObjectContains details about the product access provider.
durationstringThe duration of the product access provider.
namestringThe name of the product access provider.
papIdstringThe ID of the product access provider.
pricestringThe price of the product access provider.
typestringThe type of the product access provider.

paymentSuccess

// Insert before Tonos script tag

tonos.on('paymentSuccess', (paymentSuccessData) => {});
EVENTDESCRIPTION
paymentSuccessTriggered when a subscription plan is selected by user.
JSON ObjectDESCRIPTION
paymentSuccessData JSONObject that represents the data of the event.
{
"oI": "b61fab44-01f5-4e72-81f8-517d5b73aac7",
"papDetails": {
"papId": "d490b8a3-1d55-4e09-9c34-67e6989d0946",
"name": "96%",
"description": "96%",
"duration": "1 week(s)",
"type": "payment",
"price": "60.00€",
"hasPromotionCode": false,
"isRecurring": true,
"discountedPrice": null,
"processing": false,
"hasAccess": false,
"price_number": 6000,
"vat": 0,
"paymentType": "card"
}
}

Information about the fields inside the paymentSuccessData Object are shown in the table below.

Field NameTypeDescription
oIstringThe ID of the offer.
papDetailsObjectContains details about the product access provider.
durationstringThe duration of the product access provider.
namestringThe name of the product access provider.
papIdstringThe ID of the product access provider.
descriptionstringThe description of the product access provider.
durationstringThe duration of the product access provider.
pricestringThe price of the product access provider.
typestringThe type of the product access provider.
hasPromotionCodebooleanIndicates whether the product access provider has a promotion code.
isRecurringbooleanIndicates whether the product access provider is recurring.
discountedPriceintegerIndicates the discounted price of the product access provider.
processingbooleanIndicates whether the product access provider processing.
hasAccessbooleanIndicates whether the product access provider has access.
price_numberintegerIndicates the price of the product access provider.
vatintegerIndicates the vat amount.
paymentTypestringIndicates the payment type.

paymentFailed

// Insert before Tonos script tag

tonos.on('paymentFailed', (paymentFailedData) => {});
EVENTDESCRIPTION
paymentFailedTriggered when a subscription plan is selected by user.
JSON ObjectDESCRIPTION
paymentFailedData JSONObject that represents the data of the event.
{
"oI": "b61fab44-01f5-4e72-81f8-517d5b73aac7",
"papDetails": {
"papId": "d490b8a3-1d55-4e09-9c34-67e6989d0946",
"name": "96%",
"description": "96%",
"duration": "1 week(s)",
"type": "payment",
"price": "60.00€",
"hasPromotionCode": false,
"isRecurring": true,
"discountedPrice": null,
"processing": false,
"hasAccess": false,
"price_number": 6000,
"vat": 0,
"paymentType": "card"
}
}

Information about the fields inside the paymentFailedData Object are shown in the table below.

Field NameTypeDescription
oIstringThe ID of the offer.
papDetailsObjectContains details about the product access provider.
durationstringThe duration of the product access provider.
namestringThe name of the product access provider.
papIdstringThe ID of the product access provider.
descriptionstringThe description of the product access provider.
durationstringThe duration of the product access provider.
pricestringThe price of the product access provider.
typestringThe type of the product access provider.
hasPromotionCodebooleanIndicates whether the product access provider has a promotion code.
isRecurringbooleanIndicates whether the product access provider is recurring.
discountedPriceintegerIndicates the discounted price of the product access provider.
processingbooleanIndicates whether the product access provider processing.
hasAccessbooleanIndicates whether the product access provider has access.
price_numberintegerIndicates the price of the product access provider.
vatintegerIndicates the vat amount.
paymentTypestringIndicates the payment type.

planSelected

// Insert before Tonos script tag

tonos.on('planSelected', (planSelectedData) => {});
EVENTDESCRIPTION
planSelectedTriggered when a subscription plan is selected by user.
JSON ObjectDESCRIPTION
planSelectedData JSONObject that represents the data of the event.

planSelectedData {
"oI": "{abcd}",
"papDetails": {
"description": "{description}",
"duration": "{2 Months}",
"name": "{name}",
"papId": "{1234}",
"price": "{9.99 €}",
"type": "{payment}"
}
}

Information about the fields inside the planSelectedData Object are shown in the table below.

Field NameTypeDescription
oIstringThe ID of the offer.
papDetailsObjectContains details about the product access provider.
durationstringThe duration of the product access provider.
namestringThe name of the product access provider.
papIdstringThe ID of the product access provider.
pricestringThe price of the product access provider.
typestringThe type of the product access provider.