Code for GTM the below code can be installed via Google tag manager. You will need to update the server name from the below (which is EXAMPLE) to the server name sent to you in your set up email. If you need clarification on the name of your server this is, please speak with the support team or your account manager
- Create a new tag of type ‘Custom HTML
- Go to your Google Analytics account and copy the JavaScript snippet
- Create a new tag of type ‘Custom HTML’. Name it ‘Calltracks plug in’.
- Paste the JavaScript snippet into the input box in GTM
- save
<link href="//EXAMPLE.calltracks.com" rel="preconnect">
<script>
(function()
{ e=document.createElement("script"); e.type="text/javascript",
e.async=1,
e.src="//EXAMPLE.calltracks.com/wnd/loader.js";
document.getElementsByTagName("head")[0].appendChild(e); }
)();
</script>
Option 1
The parameter 'force_tracking=1' can be used when calling the Calltracks 'loader.js' code. This will overwrite any subsequent settings and will ensure that your dynamic numbering will work. However, when you do install user controls, remember to remove this function or any options the user chooses will be ignored.
Please note: You do not need to replace the whole Javascript on your website to use this option, simply add the bold section below to your existing Javascript on all pages.
Should you prefer to replace the whole piece of code with this example please replace the word Example with what is currently shown in your code.
Example code:
<link href="//EXAMPLE.calltracks.com" rel="preconnect">
<script>
(function()
{ e=document.createElement("script"); e.type="text/javascript",
e.async=1,
e.src="//EXAMPLE.calltracks.com/wnd/loader.js?force_tracking=1";
document.getElementsByTagName("head")[0].appendChild(e); }
)();
</script>
Option 2
You may also implement the following via Google Tag Manager:
<script>window.calltracksCookiesAllowed = true</script>
Example of a consent button that sets tracking allowed:
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/cookie-bar/cookiebar-latest.min.js"</script> <script> function pollForButton() { btn = document.getElementById("cookie-bar-button"); if(btn == undefined) { setTimeout(pollForButton, 100); } else { btn.onclick = function() { window.calltracksCookiesAllowed = true; }; } } pollForButton(); </script>
Comments