Open Google Tag Manager: https://tagmanager.google.com/
Add new account
Give a name for new account:
Setup container
Install Google Tag Manager
Сontainer ID is what we need here: GTM-XXXXX
Create a new Tag
Choose tag type - 'Custom HTML Tag':
- Name Tag: "SLICE Digital tracking – Sale" (or "SLICE Digital tracking – Lead" or whatever you like)
- Choose type - 'Custom HTML Tag'
- Continue
Configure Tag:
Tag Code
Configure Tag - General
<!--S.L.I.C.E. Digital tracking pixel :: Begin-->
<script language="JavaScript" type="text/javascript">
var afid = 'XXXX'; // (required) unique order or sale ID
var afgoal = 'XXXX'; // (required) goal name. Can be 'lead', 'sale', 'signup' or other
var afsecure = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // (required) security hash provided by S.L.I.C.E. Digital manager
var afprice = 'XXXX'; // (required) total order sum. Sale programs - required, lead programs - optional
var afcomment = ''; // (optional) any comments for this order
var custom_field1 = ''; // custom field 1
var custom_field2 = ''; // custom field 2
var custom_field3 = ''; // custom field 3
var custom_field4 = ''; // custom field 4
var custom_field5 = ''; // custom field 5
var custom_field6 = ''; // custom field 6
var custom_field7 = ''; // custom field 7
</script>
<script language="JavaScript" type="text/javascript" src="//track.roeye.co.nz/track.js"></script>
<!--S.L.I.C.E. Digital tracking pixel :: End-->
Configure Tag - Shops with dataLayer - WooCommerce/Magento/Shopify/etc.
<script>
var transactionProducts = dataLayer[0].transactionProducts;
var Products = "Products: [";
var Separator;
for(i = 0; i < transactionProducts.length; i++) {
if (i == transactionProducts.length - 1 ) {
var Separator = "]";
} else {
var Separator = ", ";
}
var Products = Products + "{id: " + transactionProducts[i].id + "; " +
"name: " + transactionProducts[i].name + "; " +
"sku: " + transactionProducts[i].sku + "; " +
"category: " + transactionProducts[i].category + "; " +
"price: " + transactionProducts[i].price + "; " +
"quantity: " + transactionProducts[i].quantity + "}" +
Separator;
}
</script>
<!-- S.L.I.C.E. Digital tracking pixel :: Begin -->
<script language="JavaScript" type="text/javascript">
var afid = dataLayer[0].transactionId; // (required) unique order or sale ID
var afgoal = 'sale'; // (required) goal name. Can be 'lead', 'sale' or anything else
var afprice = dataLayer[0].transactionTotal; // (required) total order sum. Sale programs - required, lead programs - optional
var afsecure = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // (required) security hash provided by your manager
var custom_field1 = dataLayer[0].transactionCurrency;; // (optional) checkout currency
var custom_field2 = ''; // custom field 2
var custom_field3 = ''; // custom field 3
var custom_field4 = ''; // custom field 4
var custom_field5 = ''; // custom field 5
var custom_field6 = ''; // custom field 6
var custom_field7 = ''; // custom field 7
var afcomment = Products; // (optional) any comments for this order
</script>
<script language="JavaScript" type="text/javascript" src="//track.roeye.co.nz/track.js"></script>
<!-- S.L.I.C.E. Digital tracking pixel :: End -->
Setup fire on filter:
We don't need to fire this tag everywhere. All we need - to fire it on 'Thank you' page.
- Filter name
- Type of variable (Page URL in our case)
- Operation:
- Magento: we chose 'ends with' and value '/success/' as far as we know how our confirmation page URL looks like - it ends with '/success/'
- WooCommerce: we chose 'contains' and value '/checkout/order-received/' as far as we know how our confirmation page URL looks like - it contains '/checkout/order-received'
- Save.
Save tag:
Publish changes
Check changes and publish:
Success!