How to Mask IP addresses and Force HTTPS with Google Global Site Tag gtag.js ?
In the old tracking code this is done with:
ga('set', 'forceSSL', true) //force https
ga('set', 'anonymizeIp', true) //mask ip last digits
Is this done like below in the new tracking code with gtag with { 'anonymize_ip': true }, { 'forceSSL': true} ?
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXXX-X', { 'anonymize_ip': true }, { 'forceSSL': true});
You should pass the pageview parameters as a JSON object:
gtag('config', 'UA-XXXXXX-X', { 'anonymize_ip': true, 'forceSSL': true });
See the Track Pageviews documentation.