How to connect Insightarc via Google TagManager
To install the Insightarc to your site via Google Tag Manager (GTM) is the same as a direct connection.
But sometimes the logic of Tag Manager can play differently. So here are the possible outliers and how to solve them.
Try the first connector first. If GTM remove ASYNC attribute from the connector description - try the second one below.
- You create the Custom HTML in the Tags section of Tag Manager.
- In the field of HTML you embed the following code
Replace API_KEY with the API key of the project to which you want to send data. You need only one global snippet per page.
<script async src="https://www.insightarc.com/js/iarc.js"></script>
window.iArcConfig = {
"apiKey": "API_KEY",
}
</script>
This snippet loads the iarc-clickstream.js library establishes API_KEY and connects Insightarc analytics to your site.
Sometimes Google Tag Manager (GTM) tends to remove the async attribute from the script tags because it already loads the tags asynchronously by default to ensure that it doesn't block the page from rendering.
If GTM still removes the async attribute, you can use JavaScript to create a script tag with the async attribute dynamically. Here's an example:
<script>
(function() {
var script = document.createElement('script');
script.src = 'https://www.insightarc.com/js/iarc.js';
script.async = true;
document.head.appendChild(script);
})();
window.iArcConfig = {
"apiKey": "API_KEY",
}
</script>
This JavaScript code creates a script tag dynamically with the async attribute, which GTM can't remove.