Replies: 2 comments 1 reply
-
PLEASE!!! |
Beta Was this translation helpful? Give feedback.
0 replies
-
The simplest way to load any script is via script tags as described here. So you would do something like this: <script type="text/plain" data-category="analytics">
console.log("Analytics accepted!"); // Add this line
var script = document.createElement('script');
script.src = "https://www.googletagmanager.com/gtag/js?id=G-Z9N57YTM3X";
document.head.appendChild(script);
script.onload = function() {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-Z9N57YTM3X', { 'anonymize_ip': true });
};
</script>
<script type="module" src="cookieconsent-config.js"></script> |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am basically trying to make Google Analytics load, when I click on Accept All or toggle the Analytics Switch and then Save Preferences. This is my cookieconsent-config.js and it is not working. Can u help me please?
Beta Was this translation helpful? Give feedback.
All reactions