In order for Divvit to work properly with GTM, Divvit needs to be able to gather the necessary information from GTM. GTM in turn, gathers this information from the data layer on your website. Therefore make sure you have your data layer and variables setup correctly. This will ensure Divvit receives all the information it needs and you get all the benefits Divvit provides.
You can find more detailed information about DataLayer and Variables under Google Tag Manager section here
For tracking all page views and orders we need to install two custom pixels into GTM. The first one will be fired on all pages and tracks pageviews for Divvit. The second one will be fired only on the "thankyou" page after an order has been placed successfully and track orders for Divvit.
Log in to your GTM account, click on "Tags" in the left sidebar navigation and click the "New" button on top of the page. You should reach a screen like this:
Name the tag as Divvit General.
Click on "Custom HTML Tag" and copy/paste the following code into the text field, replacing the YOUR_FRONTEND_ID with your Frontend ID from Divvit.
For Order Tracking Pixel you will use trigger called "Complete page". It is not built in GTM by default. Thus, you have to create it manually, as shown below:
Go back to "Tags" by clicking in the left sidebar and select "New" to create another pixel. Choose the same settings as above ("Custom HTML Tag") and place the following code into the text field:
Delete all lines which include a variable name that you have not set up in GTM, as described below:
If you don’t have transactionShipping remove the whole line that says:
If you don’t have transactionCurrency remove the whole line that says:
If you don’t have transactionPaymentMethod remove the whole line that says:
If you don’t have transactionDiscount remove the whole line that says:
If you don’t have transactionDiscountCode remove the whole line that says:
If you don’t have transactionCustomerID remove the whole line that says:
If you don’t have transactionProducts remove the whole line that says:
Click "Save" button.
Before you publish the Divvit scripts in Google Tag Manager, it might be a good idea to preview it and make sure it's working. To do that, click the top right button that says "Preview". If you get an error message go back to GTM section where error occurs and make sure everything is fixed.