Marcus Asplund
1 min readMay 28, 2018

--

with gtag.js, note that props are now written in snake_case:

// in index.html
<script src=”./fingerprint2.min.js”></script>
<script async src=”https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxx-x"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
new Fingerprint2({detectScreenOrientation:false}).get(function(clientId) {
gtag(‘js’, new Date());
gtag(‘config’, ‘UA-xxxxxxxx-x’, {
‘user_id’: clientId,
‘storage’: ‘none’,
‘store_gac’: false,
‘anonymize_ip’: true
});
gtag(‘send’, ‘pageview’);
});
// Update: or you could of course use uuid instead of fingerprint for better privacy protection

--

--