<script>
// Add this statement to load the bundle only if not already in the DOM
var clientId = ''; // please ask your cliendId to your account manager
var scriptUrl = 'https://data.thank-you.io/bundle-v0.4-' + clientId + '.js';
var thankYouScript = document.createElement('script');
thankYouScript.src = scriptUrl;
thankYouScript.id = 'ThankYouScript';
thankYouScript.async = 'true';
thankYouScript.dataset.exemption = 'true';
if (
Boolean(document.querySelector('script[src="' + scriptUrl + '"]')) === false
) {
if (document.readyState !== 'loading') {
document.body.appendChild(thankYouScript);
} else {
document.addEventListener('DOMContentLoaded', function () {
document.body.appendChild(thankYouScript);
});
}
}
</script>Attributes
Keys | Type | Required | Description |
thankYouScript.dataset.exemption | string | Yes | Depositing a tracker authorized by the CNIL as part of the exemption program that allows the calculation of the “Visit” indicator. |
thankYouScript.audienceDimensions | object | No | List of dimensions to send with each event. This list must contain the name of the parameter and the corresponding value. |
thankYouScript.pageUrl | string | No | By default the landing page is defined by the script's launch page. You can set a different landing page by setting this variable with a value that follows the URL format. |
thankYouScript.pageReferrer | string | No | By default, the referring page is set by the page that comes before the current page. You can define a different referring page by setting this variable with a value that follows the URL format. |
Triggering
This tag should be triggered on every page of the site. Consent isn't necessary to run this tag.
Testing
From your browser's debugger, filter requests using "data.thank-you.io" to view the ThankYou Analytics JavaScript file.
Tracker and personal data
No tracker is set by this code and no personal data is stored.
<script>
if (typeof ThankYou !== 'undefined' && ThankYou !== 'undefined') {
ThankYou.track(true);
} else {
thankYouScript.addEventListener('load', function () {
ThankYou.track(true);
});
}
</script>Triggering
This tag should be triggered when the user clicks the "Accept" button, but also on all pages of the site when the user has a positive consent status.
User Acceptance Testing (UAT)
From your browser debugger, filter requests with "ping.thank-you.io" and check that the event name in the "type" attribute has the value "consentAttribution" and that the parameter "consentStatus" is set to true. This ping is triggered automatically when the user comes from an external traffic source.
Tracker and personal data
Trackers are set by this code in the user's browser LocalStorage.
<script>
if (typeof ThankYou !== 'undefined' && ThankYou !== 'undefined') {
ThankYou.track(false);
} else {
thankYouScript.addEventListener('load', function () {
ThankYou.track(false);
});
}
</script>Triggering
This tag should not only be triggered when the user clicks the "Refuse" button, but also on all pages of the site when the user has a negative consent status.
User Acceptance Testing (UAT)
From your browser debugger, filter the requests with "ping.thank-you.io" and check that the event name in the "type" attribute is set to "consentAttribution" and the "consentStatus" parameter is set to false. This ping triggers automatically when the user comes from an external traffic source.
Tracker and personal data
No tracker is set by this code and no personal data is stored.
<script>
var tyParams = {
orderId: '123',
voucher: 'ABC',
amount: 123.32,
margin: 20,
// Custom dimensions (audience / conversion)
newClient: true,
country: 'FR'
};
if (typeof ThankYou !== 'undefined' && ThankYou !== 'undefined') {
ThankYou.pingAttributionOrder(tyParams, true);
} else {
thankYouScript.addEventListener('load', function () {
ThankYou.pingAttributionOrder(tyParams, true);
});
}
</script>Triggering
This tag must be triggered on the conversion confirmation page with consent.
User Acceptance Testing (UAT)
From your browser debugger, filter requests with "ping.thank-you.io" to display your request content.
Tracker
Trackers are read by this code on the user’s browser.
Attributes
Keys | Type | Required | Description |
tyParams.orderId | string | No | Unique transaction identifier |
tyParams.voucher | string | No | Discount code used for the transaction |
tyParams.amount | number | No | Transaction amount |
tyParams.margin | number | No | Transaction margin |
tyParams.currency | string | No | Transaction currency in ISO4217 format |
tyParams.%variableName% | string | No | Dynamic variables for creating custom filters. You can create as many variables as needed. |
<script>
var tyParams = {
orderId: '123',
voucher: 'ABC',
amount: 123.32,
margin: 20,
// Custom dimensions (audience / conversion)
newClient: true,
country: 'FR'
};
if (typeof ThankYou !== 'undefined' && ThankYou !== 'undefined') {
ThankYou.pingAttributionOrder(tyParams, false);
} else {
thankYouScript.addEventListener('load', function () {
ThankYou.pingAttributionOrder(tyParams, false);
});
}
</script>Trigger
This tag must be triggered on the conversion confirmation page if consent is refused.
Testing
From your browser's debugger, filter requests with "ping.thank-you.io" to display the content of the request.
Tracker
No tracker is read and personal identifiers like “orderId” are deleted when the data is received.
Attributes
Keys | Type | Required | Description |
tyParams.orderId | string | No | Unique transaction ID |
tyParams.voucher | string | No | Discount voucher used for the transaction |
tyParams.amount | number | No | Transaction amount |
tyParams.margin | number | No | Transaction margin |
tyParams.currency | string | No | Transaction currency in ISO4217 format |
tyParams.dv_%variableName% | string | No | Dynamic variables used to create custom filters. You can create as many variables as needed. |
Conversion enrichment lets you enrich a conversion already sent to ThankYou by adding information or changing existing elements.
<script>
var tyParams = {
orderId: '123',
voucher: 'ABC',
amount: 123.32,
margin: 20,
// Custom dimensions (audience / conversion)
newClient: true,
country: 'FR'
};
var consentStatus = true;
if (typeof ThankYou !== 'undefined' && ThankYou !== 'undefined') {
ThankYou.pingOrderEnrichment(tyParams, consentStatus);
} else {
thankYouScript.addEventListener('load', function () {
ThankYou.pingOrderEnrichment(tyParams, consentStatus);
});
}
</script>Attributes
For attributes related to conversion enrichment events, please refer to the conversion enrichment page
To turn off collection of anonymous data, just add an HTML button that calls the Do Not Track function:
<button onclick="ThankYou.doNotTrack()">
Disable audience measurement cookies
</button>To enable anonymous data collection, just add an HTML button with a call to the Do Track function:
<button onclick="ThankYou.doTrack()">
Activer les cookies de mesure d'audience
</button>