Reduce impact: Ad-blockers and Apple ITP 2.x
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
- 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. - 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). - 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.__DD_TEMP_ANALYTICS__=window.analytics;var i=document.createElement("script");i.async=!0,i.id="dreamdata-analytics",i.type="text/javascript",i.src="https://"+t+"/scripts/analytics/v1/dreamdata.min.js",i.addEventListener("load",function(i){if(analytics&&analytics.initialize)for(analytics.initialize({"Dreamdata.io":{apiKey:a,host:t}});window.__DD_TEMP_ANALYTICS__.length>0;){var n=window.__DD_TEMP_ANALYTICS__.shift(),e=n.shift();analytics[e]&&analytics[e].apply(analytics,n)}},!1);var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(i,n)}},
analytics.load("<API_KEY>", "<TRACKING_HOST>"),
analytics.page()
}();
</script>
Form tracking
It's still required to set up from tracking as described here.
Suppose you are using the auto-identify script. It's possible to load that script from your own domain as well. Just replace cdn.dreamdata.cloud with your own domain dd.company.com, and it will load.