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.
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.
Make sure to include the analytics <script>
tag above the Tonos script.
javascript
function startAnalyticsEvents() {
}
window.startAnalyticsEvents = startAnalyticsEvents;
window.addEventListener('accessible', () => {});
EVENT | DESCRIPTION | accessible | Signifies that the Tonos script is ready. This is the earliest point at which any API call should be made. |
tonos.on('appInitialize', (appData) => {});
EVENT | DESCRIPTION | appInitialize | Signifies 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 Object | DESCRIPTION | appData JSON | Object 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 Name | Type | Description | ais | Object | An object that represents the application identity settings. |
authority | string | The URL of the application identity. |
clientId | string | The ID of the client. |
redirectUri | string | Contains the URI that redirects you to the login page. |
responseType | string | Standard for every identity. |
scopes | string | Standard for every identity. |
b | integer($int32) | BiskoId |
c | bool | Indicates whether the client is logged in. |
tonos.on('checkoutAbandoned', (checkoutAbandonedData) => {});
EVENT | DESCRIPTION | checkoutAbandoned | Triggered when a user clicks back and abandons the checkout process. |
JSON Object | DESCRIPTION | checkoutAbandonedData JSON | Object 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 Name | Type | Description | oI | string | The ID of the offer. |
papDetails | Object | Contains details about the product access provider. |
duration | string | The duration of the product access provider. |
name | string | The name of the product access provider. |
papId | string | The ID of the product access provider. |
price | string | The price of the product access provider. |
type | string | The type of the product access provider. |
tonos.on('checkoutFailed', (checkoutFailedData) => {});
EVENT | DESCRIPTION | checkoutFailed | Triggered when the checkout process was not completed successfully |
JSON Object | DESCRIPTION | checkoutFailedData JSON | Object 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 Name | Type | Description | oI | string | The ID of the offer. |
papDetails | Object | Contains details about the product access provider. |
duration | string | The duration of the product access provider. |
name | string | The name of the product access provider. |
papId | string | The ID of the product access provider. |
price | string | The price of the product access provider. |
type | string | The type of the product access provider. |
tonos.on('checkoutShow', (checkoutShowData) => {});
EVENT | DESCRIPTION | checkoutShow | Triggered when checkout is shown to the user. |
JSON Object | DESCRIPTION | checkoutShowData JSON | Object 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 Name | Type | Description | oI | string | The ID of the offer. |
papDetails | Object | Contains details about the product access provider. |
duration | string | The duration of the product access provider. |
name | string | The name of the product access provider. |
papId | string | The ID of the product access provider. |
price | string | The price of the product access provider. |
type | string | The type of the product access provider. |
tonos.on('checkoutSuccess', (checkoutSuccessData) => {});
EVENT | DESCRIPTION | checkoutSuccess | Triggered when the checkout process is done successfully. |
JSON Object | DESCRIPTION | checkoutSuccessData JSON | Object 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 Name | Type | Description | oI | string | The ID of the offer. |
papDetails | Object | Contains details about the product access provider. |
duration | string | The duration of the product access provider. |
name | string | The name of the product access provider. |
papId | string | The ID of the product access provider. |
price | string | The price of the product access provider. |
type | string | The type of the product access provider. |
tonos.on('eventTrigger', (eventTriggerData) => {});
EVENT | DESCRIPTION | eventTrigger | Triggered as soon as a campaign event is triggered. |
JSON Object | DESCRIPTION | eventTriggerData JSON | Object 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 Name | eventType |
Type | string |
Description | The type of the event (Scroll, Viewport, Timer, Idle, PageView). |
tonos.on('loginShow', (loginShowData) => {});
EVENT | DESCRIPTION | loginShow | Triggered when user is redirected to login screen. |
JSON Object | DESCRIPTION | loginShowData JSON | Object 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 Name | Type | Description | tId | string | The public ID of the offer template. |
cId | string | The ID of the campaign. |
papDetails | Object | Contains details about the product access provider. |
duration | string | The duration of the product access provider. |
name | string | The name of the product access provider. |
papId | string | The ID of the product access provider. |
price | string | The price of the product access provider. |
type | string | The type of the product access provider. |
tonos.on('loginSuccess', (loginSuccessData) => {});
EVENT | DESCRIPTION | loginSuccess | Triggered when user is successfully logs in. |
JSON Object | DESCRIPTION | loginSuccessData JSON | Object 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 Name | clId |
Type | string |
Description | The ID of the client. |
tonos.on('offerClosed', (offerClosedData) => {});
EVENT | DESCRIPTION | offerClosed | Triggered when an offer is closed by the user (if applicable). |
JSON Object | DESCRIPTION | offerClosedData JSON | Object 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 Name | Type | Description | cId | string | The public ID of the campaign. |
clId | string | The ID of the client. |
oI | string | The id of the offer. |
type | string | Represents the offer type: inline or modal. |
paps | Object | Represents the product access providers as an object. |
description | string | The description of the product access provider. |
duration | string | The duration of the product access provider. |
name | string | The name of the product access provider. |
papId | string | The ID of the product access provider. |
price | string | The price of the product access provider. |
type | string | The type of the product access provider. |
tonos.on('offerPlans', (offerPlansData) => {});
EVENT | DESCRIPTION | offerPlans | Triggered when an offer is presented to the user. |
JSON Object | DESCRIPTION | offerPlansData JSON | Object that represents the data of the event. |
"paps": [
{0}: {
"description": "{description}",
"duration": "{2 Months}",
"name": "{name}",
"papId": "{1234}",
"price": "{9.99 €}",
"type": "{payment}"
}
]
Field Name | Type | Description | paps | Object | Represents the product access providers as an object. |
description | string | The description of the product access provider. |
duration | string | The duration of the product access provider. |
name | string | The name of the product access provider. |
papId | string | The ID of the product access provider. |
price | string | The price of the product access provider. |
type | string | The type of the product access provider. |
tonos.on('offerShown', (offerData) => {});
EVENT | DESCRIPTION | offerShown | Triggered when an offer is presented to the user. |
JSON Object | DESCRIPTION | offerData JSON | Object 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 Name | Type | Description | cId | string | The public ID of the campaign. |
clId | string | The ID of the client. |
oI | string | The id of the offer. |
type | string | Represents the offer type: inline or modal. |
paps | Object | Represents the product access providers as an object. |
description | string | The description of the product access provider. |
duration | string | The duration of the product access provider. |
name | string | The name of the product access provider. |
papId | string | The ID of the product access provider. |
price | string | The price of the product access provider. |
type | string | The type of the product access provider. |
pageInitialize
tonos.on('pageInitialize', (pageData) => {});
EVENT | DESCRIPTION | pageInitialize | Signifies that the Tonos script now has been initialized for this page and can get all campaigns that are active for this pageview. |
JSON Object | DESCRIPTION | pageData JSON | Object 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 Name | Type | Description | pc | Object | Object that represents the campaign of the page. |
cid | string | The public ID of the campaign. |
n | string | The name of the campaign. |
e | array[Object] | Array of objects that returns the trigger events. |
sd | integer($int32) | The seconds delay per timer, which indicates after how many seconds the offer will be showed to the user. |
meid | string | The ID of the media element. |
tcp | string | Indicates the time in seconds when the event will be triggered. |
eid | integer($int32) | The ID of the event. |
po | array[Object] | The template cards. |
tid | string | The public ID of the offer template. |
t | string | The type of the offer template. |
is | string | The ID of the HTML element where the offer will be placed. |
p | integer($int32) | The ID of the page. |
pid | string | The public ID of the page. |
tonos.on('paymentShow', (paymentShowData) => {});
EVENT | DESCRIPTION | paymentShow | Triggered when user is sent to payment gateway. |
JSON Object | DESCRIPTION | paymentShowData JSON | Object 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 Name | Type | Description | gwUrl | string | The URL of the GoPay product access provider. |
papDetails | Object | Contains details about the product access provider. |
duration | string | The duration of the product access provider. |
name | string | The name of the product access provider. |
papId | string | The ID of the product access provider. |
price | string | The price of the product access provider. |
type | string | The type of the product access provider. |
tonos.on('paymentSuccess', (paymentSuccessData) => {});
EVENT | DESCRIPTION | paymentSuccess | Triggered when a subscription plan is selected by user. |
JSON Object | DESCRIPTION | paymentSuccessData JSON | Object 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 Name | Type | Description | oI | string | The ID of the offer. |
papDetails | Object | Contains details about the product access provider. |
duration | string | The duration of the product access provider. |
name | string | The name of the product access provider. |
papId | string | The ID of the product access provider. |
description | string | The description of the product access provider. |
duration | string | The duration of the product access provider. |
price | string | The price of the product access provider. |
type | string | The type of the product access provider. |
hasPromotionCode | boolean | Indicates whether the product access provider has a promotion code. |
isRecurring | boolean | Indicates whether the product access provider is recurring. |
discountedPrice | integer | Indicates the discounted price of the product access provider. |
processing | boolean | Indicates whether the product access provider processing. |
hasAccess | boolean | Indicates whether the product access provider has access. |
price_number | integer | Indicates the price of the product access provider. |
vat | integer | Indicates the vat amount. |
paymentType | string | Indicates the payment type. |
tonos.on('paymentFailed', (paymentFailedData) => {});
EVENT | DESCRIPTION | paymentFailed | Triggered when a subscription plan is selected by user. |
JSON Object | DESCRIPTION | paymentFailedData JSON | Object 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 Name | Type | Description | oI | string | The ID of the offer. |
papDetails | Object | Contains details about the product access provider. |
duration | string | The duration of the product access provider. |
name | string | The name of the product access provider. |
papId | string | The ID of the product access provider. |
description | string | The description of the product access provider. |
duration | string | The duration of the product access provider. |
price | string | The price of the product access provider. |
type | string | The type of the product access provider. |
hasPromotionCode | boolean | Indicates whether the product access provider has a promotion code. |
isRecurring | boolean | Indicates whether the product access provider is recurring. |
discountedPrice | integer | Indicates the discounted price of the product access provider. |
processing | boolean | Indicates whether the product access provider processing. |
hasAccess | boolean | Indicates whether the product access provider has access. |
price_number | integer | Indicates the price of the product access provider. |
vat | integer | Indicates the vat amount. |
paymentType | string | Indicates the payment type. |
tonos.on('planSelected', (planSelectedData) => {});
EVENT | DESCRIPTION | planSelected | Triggered when a subscription plan is selected by user. |
JSON Object | DESCRIPTION | planSelectedData JSON | Object 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 Name | Type | Description | oI | string | The ID of the offer. |
papDetails | Object | Contains details about the product access provider. |
duration | string | The duration of the product access provider. |
name | string | The name of the product access provider. |
papId | string | The ID of the product access provider. |
price | string | The price of the product access provider. |
type | string | The type of the product access provider. |