Subdomain Tracking

Track visitors across subdomains of the same root domain.

Subdomain Tracking

EngageTrack handles subdomain tracking automatically in most cases. This guide covers how to configure tracking for different subdomain setups.

Default Behavior

In the default memory mode, the SDK uses no device storage at all — visitor identification is handled server-side via a daily-rotating hash. This means all subdomains are treated equally: visitors are identified by the same hash within a single day, regardless of which subdomain they visit.

In storage mode (data-persistence="storage"), the SDK stores the visitor ID in localStorage. Since localStorage is scoped to the exact origin, different subdomains maintain separate storage:

  • Same-origin pages (e.g., www.example.com/blog and www.example.com/app) share identity automatically
  • Different subdomains (e.g., www.example.com and app.example.com) do not share localStorage by default — each subdomain will generate its own visitor ID

The SDK also filters out self-referrals between subdomains. If a visitor navigates from blog.example.com to app.example.com, the referrer is treated as direct — not as an external source.

Setup for Separate Tracking

If you want to track each subdomain as an independent site with its own dashboard, create a separate site in EngageTrack for each subdomain and use different site IDs:

<!-- On blog.example.com -->
<script
	defer
	data-site-id="BLOG_SITE_ID"
	src="https://cdn.engagetrack.net/sdk.js"
></script>
 
<!-- On app.example.com -->
<script
	defer
	data-site-id="APP_SITE_ID"
	src="https://cdn.engagetrack.net/sdk.js"
></script>

Each site will have its own analytics, visitors, and revenue data.

Setup for Unified Tracking

To track all subdomains under a single site in EngageTrack, use the same site ID on every subdomain:

<!-- On www.example.com -->
<script
	defer
	data-site-id="YOUR_SITE_ID"
	src="https://cdn.engagetrack.net/sdk.js"
></script>
 
<!-- On blog.example.com -->
<script
	defer
	data-site-id="YOUR_SITE_ID"
	src="https://cdn.engagetrack.net/sdk.js"
></script>
 
<!-- On app.example.com -->
<script
	defer
	data-site-id="YOUR_SITE_ID"
	src="https://cdn.engagetrack.net/sdk.js"
></script>

All pageviews and events from every subdomain will appear in the same dashboard. You can filter by hostname in the Pages report to isolate traffic from a specific subdomain.

In storage mode, localStorage is scoped to the exact origin, so visitor IDs will differ between subdomains. To stitch visitor sessions across subdomains, use cross-domain tracking with data-persistence="storage" and data-allowed-hostnames. In the default memory mode, the server-side hash naturally handles same-day visitor identification across subdomains.

Filtering by Subdomain

When using unified tracking, you can segment data by subdomain in the dashboard:

  1. Go to the Pages report
  2. Use the hostname filter to select a specific subdomain
  3. All metrics (visitors, pageviews, bounce rate) will be scoped to that subdomain

You can also create goals that target specific subdomains by filtering on the page URL.