Script Tracking Client-Side
Introduction
Thanks to the implementation of our conversion tracking script, Click2Buy is able to collect validated sales generated by users coming from our solution.
This tracking enables brands to accurately measure the ROI of the traffic directed to retailer websites via the Click2Buy Where to Buy solution.
To set up the tracking, you will need your Retailer Key, which will be provided by your Click2Buy Retailer Account Manager. This identifier will be used in both available implementation methods.
Two implementation methods are available:
🏷️ Via Google Tag Manager
Recommended — the simplest and fastest method to implement.
💻 Via a native implementation
Direct integration within the website code.
Implementation via Google Tag Manager
We have developed an official Google Tag Manager template that allows for easy implementation of Click2Buy conversion tracking. This template enables retailers to configure tracking without needing to write any custom code. To install the tag, simply refer to our GitHub documentation, which includes:
- detailed installation instructions
- the template file to import into Google Tag Manager
- the steps required to configure the tag
During the tag configuration, you will only need to enter your Retailer Key, which will be provided by your Click2Buy contact.
👉 All documentation and required files are available here: https://github.com/Click2Buy/gtm-web-template/tree/master?tab=readme-ov-file
Native Implementation (direct code)
This guide will precise the implementation method of our tag which will allow us to retrieve the sale validation as well as the contents of the cart. For this, you will need to execute a specific code on the success/confirmation page with the contents of the order.
When the order confirmation page will be loading, you will need to load the following script:
<!-- Click2Buy retailer script -->
<script>
(function(i,s,o,g,r,a,m){i[r]=i[r]||{q:[],validationProcess:function(){
i[r].q.push(arguments)}};a=s.createElement(o);m=s.getElementsByTagName(o)[0];
a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://rs.clic2buy.com/retailers/__KEY_RETAILER__.js','C2B');
C2B.validationProcess(__PARAMS__);
</script>KEY_RETAILER represents the ID that has been provided to you by your Click2Buy contact.
PARAMS must be replaced by the order’s information according to the format just below (or according to your datalayer).
Parameters of the C2B.validationProcess function
The function must receive as a parameters an object with the following fields:
| Field | Value type | Mandatory | Description |
|---|---|---|---|
totalAmount | Number | Yes | Total amount of the basket |
currency | String | Yes | Basket currency (ISO4217) |
products | Array | Yes | Table containing one object per product of the order - the format is detailed below |
Fields of produced objects
| Field | Value type | Mandatory | Description |
|---|---|---|---|
ean | String | Yes | EAN-13 code of the product |
upc | String | No | UPC code of the product |
retailerReference | String | Yes | Product reference, retailer-specific |
amount | Number | Yes | Unit price of the product |
quantity | Number | Yes | Product quantity |
name | String | Yes | Product name |
packaging | String | No | Product packaging |
brand | String | Yes | Product brand |
manufacturerReference | String | No | Product reference (brand specific) |
metadata | JSON | No | Other useful data of the product (free structure) |
In order to value this data, we will need to have at least the product’s EAN or UPC code. If you do not have this information, you can send us your internal reference (retailerReference).
N.B : If you can’t provide some fields, you can leave it empty. If for your configuration it is mandatory for you to have a value for every field then you can push “null” as default variable.
⚠️ Warning : When copying and pasting the script into certain text editors, quotation marks (" ") may be automatically modified. Please ensure they are correctly formatted to avoid any errors in the script execution.
Domains to whitelist
Our tag uses multiple subdomains to function correctly. If your security policy blocks the loading of external scripts, it is necessary to allow the following domains.
You can allow:
- *.clic2buy.com
- *.clic2drive.com
- *.click2buy.com
Or allow the following specific domains:
rs.clic2buy.com (mandatory) Domain where the tracking script is hosted.
t.clic2buy.com (mandatory) Domain used for our third-party cookies. It allows retrieving the anonymous ID assigned to users from our solution on your site.
analytics.clic2drive.com (mandatory) Domain that allows retrieving basket information via the user ID and recording the sale validation.
Data collected
Our tag only collects basket confirmations coming from Click2Buy redirects.
No personal data is collected.
When a user arrives on the retailer’s site via the Where to Buy solution, an anonymous cookie is created to identify the traffic source and measure conversions.
Click2Buy is GDPR compliant.
For any questions related to data protection, you can contact our DPO:
Artaches Kherounts📧 dpo@click2buy.com📞 +33 3 66 72 29 04