Front-end tracking and missing data? Use our SDK proxy!
Topics
Introduction
Users use ad-blockers. It's a fact of life.
When ad-blockers are installed, browsers typically block the sending of identify
, group
, track
and page
calls. This can disrupt your first-party tracking efforts, even if users have explicitly consented to sharing their data with you.
One solution is to use back-end tracking (The Node.js SDK, The PHP SDK, The Ruby SDK, The Python SDK, The .Net / C# SDK, ...). Yet, that's not always possible or might require too much work.
Another solution is to install a proxy domain, which comes default with journy.io.
Setting up the proxy domain
When you install our API/SDK connector, giving it a name, opening it and navigating to the source tab, you'll see this:
By default, "Use proxy domain" is disabled.
When you enable it, you'll be asked to enter a subdomain of your top domain.
Even if your app is e.g. hosted on 'app.cloud.A.site.com', 'site.com' is your top domain, and you would need to consider creating e.g. analyze.site.com as proxy domain.
You'll then need to add a CNAME record in your DNS service, typically looking something like:
CNAME analyze.site.com analyze.journy.io TTL=600
Changes that comes with a proxy domain
Once you've set up the SDK proxy, you'll see that the initiation code for our front-end JavaScript SDK has changed.
It used to be this:
import { AnalyticsBrowser } from "@segment/analytics-next";
const analytics = AnalyticsBrowser.load(
{
writeKey: "YOUR_WRITE_KEY",
cdnURL: "https://analyze.journy.io/frontend",
},
{
integrations: {
"Segment.io": {
apiHost: "analyze.journy.io/frontend/v1",
},
},
}
);
And now it's this:
import { AnalyticsBrowser } from "@segment/analytics-next";
const analytics = AnalyticsBrowser.load(
{
writeKey: "YOUR_WRITE_KEY",
cdnURL: "https://analyze.site.com/frontend",
},
{
integrations: {
"Segment.io": {
apiHost: "analyze.site.com/frontend/v1",
},
},
}
);
Your user's ad-blockers will now see code that tries to execute within it's own domain, and will not block any traffic.