You have the possibility from your campaigns to create tracked links and share them with the KOLs of your choice. Several useful data can then be retrieved:
Number of clicks
Sources of clicks
Geographic (Country/City)
Social networks
You can now track sales on your e-commerce site from these links generated in the application. Shopify and Prestashop are natively supported, do not hesitate to contact your Kolsquare contact or our support in order to best support you on other CMS or custom sites.
Shopify
First step
Go to your Shopify admin
Go to the "Themes" tab of your online store from the left menu, or go directly to this link: https://admin.shopify.com/store/kolshopp/themes
â
âOnce in the "Theme" page, identify your current Theme and click on the corresponding 3 dots, then on "Edit code"
â
âLook for the "theme.liquid" file. You will find it more easily thanks to the search bar at the top left, then click on it (the file will open on the right panel)
â
âIn this file, go to the very bottom of it and paste the following code there (Be careful not to delete the existing code):
âWARNING: Paste the code just before the </body> and </html> tags as in the following screenshot
â<script>
if (window) {const urlParams = new URLSearchParams(window?.location?.search);
const sales_token = urlParams.get('ts');
if (sales_token) {window.localStorage.setItem('kolsquare', JSON.stringify({ sales_token }));}}
</script>Save your modification
Second step
Go to your Shopify admin
Search for "Pixels" in the search bar and click on "Pixels" in the search results
â
âOnce in the "Pixels" menu (Customer Events), click on "Add custom pixel"
â
âName the custom pixel âKolsquareâ to make it easier to find.
âIn the Customer Privacy section, unfold the two banners "Permission" and "Data sale". And select "Not required" for the first one, and "Data collected does not qualify as data sale" for the second one.
â
âIn the "Code" section, delete the content already present, and copy-paste the following code:
â
âfunction getCoupons(checkout) {
const allDiscountCodes = checkout.discountApplications.map((discount) => {
if (discount.type === 'DISCOUNT_CODE') {
return discount.title;
}
});
return allDiscountCodes.join(", ");
}
analytics.subscribe('checkout_completed', (event) => {
const { sales_token } = JSON.parse(window.localStorage.getItem('kolsquare'));
if (!sales_token) return null;
const checkoutTracking = async data => {
if (!sales_token) return null;
const response = await
fetch(`https://api.kolsquare.com/influence/tracking_links/sales/${sales_token}`, {
method: 'POST',
body: JSON.stringify({ tracking_link_sale: {
order_id: event.data.checkout.order?.id,
total_price: event.data.checkout.totalPrice.amount,
currency: event.data.checkout.totalPrice.currencyCode,
items_count: event.data.checkout.lineItems.length,
created_at: event.timestamp,
discount_code: getCoupons(event.data.checkout),
store_framework: 'shopify_pixel'
}}),
headers: {
'Content-type': 'application/json',
'Access-Control-Allow-Origin': '*',
},
})
return response;
}
checkoutTracking(event).then(() =>
window.localStorage.removeItem('kolsquare'));
});Save via the button at the top of the page. And confirm the save if necessary.
â
âClick "Connect" to put the pixel online
â
âThe pixel is installed!
From now on, when a person places an order from a tracked link generated from Kolsquare, the sales information will be visible in the "Reporting" tab of your campaign.
Prestashop
Go to youre Prestashop admin
Got to the "Modules" > "Module Manager"
â
âOnce on the page, click on "Upload a module" at the top right of the page
â
âChoose the file "kolsquare.zip" which you can find here
â
âThe module is installed!
â
From now on, when a person places an order from a tracked link generated from Kolsquare, the sales information will be visible in the "Reporting" tab of your campaign.
Other e-shop and custom e-shop
We will able to track sales only by sharing tracking links generated in influence.
campaigns -> tracking links
To leave Kolsquare link your campaign with your sales, you have to put 2 codesâs chunk in
your code base.
To do so, paste the code below at the right place to load the script in first load. (Each page should be
able to load the script)
const urlParams = new URLSearchParams(window.location.search);
const sales_token = urlParams.get('ts');
if (sales_token) {
window.localStorage.setItem('kolsquare', JSON.stringify({ sales_token }));
}
Then add the code below to your checkout page. (The submission must trigger the function).
const kolsquare_tracking_sales = async () => {
const { sales_token } = JSON.parse(window.localStorage.getItem('kolsquare'));
const data = {
order_id: // put your order_id,
order_number: // put your order_number,
total_price: // put your total_price,
currency: // put your currency,
items_count: // put your items_count,
created_at: // put your created_at,
discount_code: // put your discount_code,
}
if (!sales_token) return null;
return await fetch(`https://api.kolsquare.com/influence/tracking_links/sales/${sales_token}`, {
method: 'POST',
body: JSON.stringify({ tracking_link_sale: data }),
headers: {
'Content-type': 'application/json',
'Access-Control-Allow-Origin': '*',
},
'Cache-Control': 'no-cache',
})
}
kolsquare_tracking_sales().then(() => window.localStorage.removeItem('kolsquare'));The code is written as an example. You can modify it as you wish. Only the data object and
retrieval url cannot be modified.
Once your setup is done, we will catch the data et put it in your campaign reporting đ
The data that will be uploaded in the application
Sales data is synchronized twice a day to update your reports
Number of sales
Revenue
Average basket
Number or articles
Average number of articles per sale
ROI (Revenue - Invested budget)
ROAS (Revenue / Invested budget)
Conversion rate (Number of sales / Number of clicks)
