Hi All,
How can integrate Onetrust with Google analytics on my site?
I inserted on site Onetrust cookie banner and Google analytics.
If I visit the site Google analytics works independently if you accept cookies or not and send track event.
I would manage Google Analytics from Onetrust and send track of Google analytics only when user accept cookie.
Is it possible? How can I do?
How configure GA with hubspot and Onetrust (use is mandatory)?
An example or article is more appreciate.
Thanks
@Mike_Eastwood , have you configured anything like this before?
At the end I used a piece of code similar to this:
<script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);}
gtag(‘set’, ‘developer_id.dNzMyY2’, true);
gtag(‘consent’, ‘default’, {‘analytics_storage’: ‘denied’}); gtag(‘consent’, ‘default’, {‘ads_storage’: ‘denied’}); </script>
In your OneTrust CDN tag, make sure to implement the additional logic in the OptanonWrapper function.
<script type=“text/javascript”>
function OptanonWrapper() {
if (OnetrustActiveGroups.indexOf(‘C0002’) != -1)
{ gtag(‘consent’, ‘update’, {‘analytics_storage’: ‘granted’})};
if (OnetrustActiveGroups.indexOf(‘C0004’) != -1)
{ gtag(‘consent’, ‘update’, {‘ads_storage’: ‘granted’})};
}
</script>