We recommend that you use GTM to work with our cookie widget. No need to get your hands dirty, all of this can be done in the GTM interface.
Creating the account
Start by creating your account by clicking here. Because it's a Google product, you can use your usual Google account.
Add your account by giving it a name, then indicate the container name, which is your site address. You will also have to specify the platform of your container. Click on "Create" and accept the terms of service.
GTM will now give you a code, this HTML code will be added to your site, and it will be the only one to add , because all the other tags will be added by GTM.
Add the HTML code
– Add the code myself
If you know a little bit of coding, you can try to add it yourself. Copy the code and paste it in the <head> section of your page. Then copy the second code and paste it after the <body> tag.
Go to WordPress, « Extensions », « Add », write the extension name in the search bar on the left, then click on Install.
Copy your GTM code, you will find it on your GTM homepage, or by clicking on the blue diamond on the far left.
Now you just have to paste your code into the field "Google Tag Manager ID"
You can select "Codeless injection" but be sure to check that your site loads properly then click on "Save modifications". If it doesn't load properly, select "Footer of the page".
Create your tags
Once your GTM HTML code online on your site, you will be able to create your tags
The first tag we will create will be destined to Google Analytics. To create a tag is really simple, first click on "Add a tag"
Then configure it by selecting its type, in that case, we'll use "Google Analytics (Universal)"
You will then have to connect your Google Analytics account. For that, in "Google Analytics Parameters", add a variable and indicate your Google Analytics ID.
Once you have added the code, you will have to manage when the tag will be triggered by adding a trigger
There is 6 trigger types
– Page view (Web)
– Clicks (Web)
– Form submission (Web)
– History Change (Web)
– Timer (Web)
– Custom event (Web and mobile)
First, click on the pencil in front of Trigger. In our case we want the tag to trigger when a page is displayed in the user's explorer, we will then choose "Page view". Click on "Save" on the top-right.
Important: If you already added an HTML Code for Google Analytics, you will have to delete it, or it will load twice and thus distort your results.
Don't forget to click on "Send" to publish your tag on your site
You just published your first tag! Now let's do the same with your other tags.
Create a custom tag
In this next example, we'll see how to add a Facebook tracking pixel on your site. It's a little bit of code that will allow you to measure your ads conversions. When you add this pixel on your site you can see the conversions that have been made, who clicked on your ad, this can allow you to do ad retargetting, by aiming at users that already visited your website.
There is no Facebook tag in GTM, so we have to make it ourselves. Just like before, click on "Add a tag", "Tag configuration", then "custom HTML".
[If you never used Facebook tracking pixel, here is how and where to find it: Go to your Facebook ad manager, click on "Tools", then "Pixels", "Configure pixel", then "Copy/Paste the code". ]
Then, copy and paste your HTML Facebook code in the text area.
Once again we want this code on all pages, so we pick "All Pages" as the trigger, then we can click on "Save"
Finally, give it a more appropriate name: « Facebook pixel All Pages ».
Here you go, you just added the Facebook tracking pixel on your website!
Add a rule
What is a rule ?
A rule is adding a timer and make it so the tag only shows up after a certain duration.
Click on "Add a tag", "Tag configuration", then "custom HTML" and paste your Facebook tracking code.
Then, you will have to create your own trigger. Click on "triggering", then "+", then the pencil, and finally "Timer".
Fill the boxes.
Interval: Be careful, it's in milliseconds. For example, 120 000 is the equivalent of 2 minutes.
Limit: 1 time, because we want it to only trigger once.
Now you can choose the page where you want it to trigger, select "Page URL", "starts with", "your page adress". Click on "Save" and rename your trigger.
Your custom trigger is created, you can now "Save" and rename your tag.
Once you are done adding your tags, click on the "Submit" button at the top-right. Add a name and a description and click on "Publish".
Thanks to SocialMediaPro for this complete guide !