Skip to content

Instantly share code, notes, and snippets.

@inetbiz
Last active August 19, 2021 14:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inetbiz/f1db85dcff1665b6a0c273795804ad7e to your computer and use it in GitHub Desktop.
Save inetbiz/f1db85dcff1665b6a0c273795804ad7e to your computer and use it in GitHub Desktop.
Google Tag - User Timings
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxx-xx"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('set',{'content_group1':'{{page.title}}'});
if (window.performance) {
var timeSincePageLoad = Math.round(performance.now());
gtag('event', 'timing_complete', {
'name': 'load',
'value': timeSincePageLoad,
'event_category': 'Page Render Time'
});
} gtag('config', 'UA-xxxxxxx-xx');
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment