Hola! ¡Tenemos nuestra Comunidad en Español!

Anonymize ip analytics

Highlighted
Occasional Contributor

Hello,

we want to develop a code to comply with our new European GDPR law.

In analytics we are going to set it to anonymizeip = yes

The problem es how to filter our own traffic with this configuration, the way you can filter this is in the back - end. Because of this, we have develope a script with HUBL, here you have this code, we share it if it is useful for anybody and if you want to send us any improvement or suggestion is welcomed.

 

Because we use GTM, we push a datalayer (and we use a custom dimension to filter this traffic), with just analytics, the solution is a little bit

different

 

{% set IPlist = ['00.00.00.00', '11.11.11.11', '22.22.22.22'] %}
{% set actualIP = request.remote_ip %}
{% if actualIP in IPlist %}
//<script> you have to delete // and this comment, we add this just to be possible to publish this post
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'trafficToFilter' : 'yes'
});

//</script> you have to delete // when you use this code

{%endif%}

 

best regards

 

 

Reply
0 Upvotes
2 Replies
HubSpot Moderator

Hi @stabuenca Thank you for sharing this. Can you explain a bit further why this was neccesary and what problem this solves? 

 

Thank you,

Ed Justen


Did my post help answer your query? Help the Community by marking it as a solution
Reply
0 Upvotes
Occasional Contributor

When you set anonymized ip to true, you can't filter IPs, with this solution you can filter ips and if you want to filter your own internal traffic, you can.

 

 

Reply
0 Upvotes