Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save a11smiles/11167d317752d53fe22e79f2483771f4 to your computer and use it in GitHub Desktop.
Save a11smiles/11167d317752d53fe22e79f2483771f4 to your computer and use it in GitHub Desktop.
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
Promise.all([
new Promise((resolve) => {
var script = document.createElement('script');
script.src = "https://www.googletagmanager.com/gtag/js?id=UA-173474946-1";
script.async = true;
document.body.appendChild(script);
resolve();
}),
new Promise((resolve) => {
gtag('js', new Date());
gtag('config', 'UA-173474946-1');
resolve();
})
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment