Reduce impact from ad-blockers and Apple ITP 2.x

Ole Dallerup Updated by Ole Dallerup

Ad-blockers

In 2022 more than 40% of all internet users have installed an ad-blocker on their browser, which might also block your analytics scripts. By loading your analytics script from your domain, you can reduce the risk of ad-blockers on your site. This way, you see the traffic from users using ad-blockers, giving you insights you didn't have access to before. How much ad-blockers currently impact you depends on the location of your visitors and details around the persona you are targeting. Generally, we have experienced that the more technical your visitors are, for example, software engineers, the more likely they have an ad-blocker installed. 

Apple intelligent-tracking-prevention

When your visitors are using Apple Safari, you could get impacted by Apple ITP 2.x (Apple intelligent-tracking-prevention). Dreamdata does not use third-party cookies, so in either case, the impact of Apple ITP 2.x is limited. By loading the script from your domain, you ensure that Safari continues seeing the cookies as 1st party.

Load analytics.js from your domain

  1. To set up your domain for loading analytics, pick a sub-domain example dd.company.com. When you have done that, you should set up the following CNAME: {your-selected-domain.company.com} -> {slug}.customers.dreamdata.cloud
    You will see your slug by logging into your app.dreamdata.io and looking at the URL.
  2. Contact us at friends@dreamdata.io and be sure to share {your-selected-domain.company.com} with us. Dreamdata must add a configuration to enable SSL/HTTPS for your domain.
    After that, we will come back to you with an updated script for you to update on your website or inside Google Tag Manager (to use Google Tag Manager, see below).
  3. You can install the new script as below; remember to replace <API_KEY> and <TRACKING_HOST> before inserting the script on your website.
<script>
!function(){window.analytics||(window.analytics=[]),window.analytics.methods=["identify","track","trackLink","trackForm","trackClick","trackSubmit","page","pageview","ab","alias","ready","group","on","once","off","setAnonymousId"],window.analytics.factory=function(a){return function(){var t=Array.prototype.slice.call(arguments);return t.unshift(a),window.analytics.push(t),window.analytics}};for(var a=0;a<window.analytics.methods.length;a++){var t=window.analytics.methods[a];window.analytics[t]=window.analytics.factory(t)}analytics.load=function(a,t){if(!document.getElementById("dreamdata-analytics")){t=t||"cdn.dreamdata.cloud",window.a=window.analytics;var e=document.createElement("script");e.async=!0,e.id="dreamdata-analytics",e.type="text/javascript",e.src="https://"+t+"/scripts/analytics/v1/dreamdata.min.js";var n=function(){if(analytics&&analytics.initialize)for(analytics.initialize({"Dreamdata.io":{apiKey:a,host:t}});window.a.length>0;){var e=window.a.shift(),n=e.shift();analytics[n]&&analytics[n].apply(analytics,e)}};e.addEventListener?e.addEventListener("load",function(){n()},!1):e.onreadystatechange=function(){("complete"==this.readyState||"loaded"==this.readyState)&&n()};var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(e,i)}},

analytics.load("<API_KEY>", "<TRACKING_HOST>"),
analytics.page()
}();
</script>

What if we are using Google Tag Manager?

If you are using Google Tag Manager, you must load the GTM script from a separate domain to avoid ad-blockers from blocking it, thereby blocking the Dreamdata script. We have made it easy, and if you have already done the setup, then all you have to do is to replace googletagmanager.com with the domain from where you will load your analytics {your-selected-domain.company.com}/gtm as the example below and ad-blockers won’t be block your GTM script.

We recommend always taking the script from Google Tag Manager for the latest version.

<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});varf=d.getElementsByTagName(s[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://{your-selected-domain.company.com}/gtm/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','{your-GTM-id}');</script>

Note: This will ensure that your GTM script is loaded even when an ad-blocker is installed. It does not prevent scripts loaded by GTM from being blocked by ad-blockers. This could be Google Analytics, LinkedIn Ads, Facebook Ads, etc.

What if we are using Segment?

Segment.com has a solution for this as well. Reach out to Segment at friends@segment.com for more information.

How did we do?

Form Tracking

Pardot iframe form tracking

Contact