Documentation Index
Fetch the complete documentation index at: https://mintlify.com/vemetric/vemetric/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Cross-subdomain tracking allows you to follow a user’s journey as they navigate between different subdomains of your website. For example, tracking users moving fromwww.example.com to app.example.com to docs.example.com.
Vemetric automatically handles cross-subdomain tracking when configured correctly, using a single cookie domain to maintain user identity across all subdomains.
How It Works
Cookie Domain Scope
Vemetric sets the_vuid cookie with a domain scope that covers all subdomains:
Cookie Configuration
The tracking cookie is configured with these attributes:- Domain: Set to your base domain (e.g.,
.example.com) - Path:
/(accessible from all paths) - Secure:
true(requires HTTPS) - HttpOnly:
true(not accessible via JavaScript) - SameSite:
None(allows cross-site requests)
Setup Instructions
Initialize Vemetric on Each Subdomain
Install and initialize the Vemetric SDK on every subdomain:
Use the same project token across all subdomains to ensure events are tracked under the same project.
Set Your Base Domain
Configure your base domain in the Vemetric project settings:
- Go to Project Settings in the dashboard
- Set Domain to your base domain (e.g.,
example.com) - Save changes
Proxy Setup for Subdomains
If you’re using different subdomains for different purposes, you can use thev-host header to proxy requests:
What is the V-Host Header?
Thev-host header tells Vemetric which subdomain the event originated from, ensuring:
- Cookies are set for the correct domain
- Outbound link detection works properly
- Referrer tracking is accurate
Implementation
Advanced: Manual Header Configuration
Advanced: Manual Header Configuration
If you’re using a custom implementation, include the
v-host header:Tracking Subdomain Navigation
Internal vs External Links
Vemetric automatically distinguishes between:- Internal subdomain navigation: Moving from
www.example.comtoapp.example.com - External links: Clicking to
https://google.com
Session Continuity
Sessions continue across subdomains as long as:- The user navigates within the 30-minute session window
- The same cookie is accessible on both subdomains
- The user has not cleared cookies or switched browsers
Common Scenarios
- Marketing to Product
- App to Documentation
- Checkout Flow
Scenario: Users land on your marketing site (
www.example.com) and sign up for your product (app.example.com).Tracking flow:- User visits
www.example.com→ Session starts, user ID assigned - User clicks “Sign Up” → Navigation tracked
- User lands on
app.example.com/signup→ Same user ID, session continues - User completes signup →
signup_completedevent tracked - User enters dashboard → Full funnel visible in analytics
- Attribute signups to marketing campaigns
- Analyze conversion paths
- Track time from landing to activation
Troubleshooting
Users are getting new IDs on subdomain navigation
Users are getting new IDs on subdomain navigation
Sessions are breaking between subdomains
Sessions are breaking between subdomains
Possible causes:
- Session timeout (30-minute inactivity)
- Cookie being deleted or blocked
- Different project tokens used on different subdomains
- Verify the same project token is used everywhere
- Check that cookies are not being cleared by other scripts
- Monitor session duration in analytics
- Test with browser developer tools open to watch cookie behavior
Outbound links to other subdomains
Outbound links to other subdomains
Problem: Links to other subdomains are being tracked as outbound links instead of internal navigation.Cause: The project domain setting doesn’t match your base domain.Solution:
- Go to Project Settings
- Set Domain to your base domain (e.g.,
example.com) - Do not include
wwwor protocol - Save and test again
Cookie not accessible across subdomains
Cookie not accessible across subdomains
Privacy Considerations
Cookie Consent
When tracking across subdomains, your cookie consent banner should:- Clearly state that tracking occurs across all subdomains
- List all subdomains where tracking is active
- Allow users to opt out of cross-subdomain tracking
Data Isolation
If you need to keep certain subdomain data separate:- Use different project tokens for different subdomain groups
- Create separate projects in Vemetric dashboard
- Filter analytics views by subdomain using custom properties
Testing Checklist
Before deploying cross-subdomain tracking to production:Cookie Inspection
- Cookie
_vuidis set with domain.example.com - Cookie has
SecureandHttpOnlyflags - Cookie has
SameSite=None - Cookie expires far in the future (400 days)
Cross-Subdomain Navigation
- Same user ID maintained when navigating between subdomains
- Session continues across subdomain boundaries
- Page views tracked on all subdomains
- Referrer information captured correctly
Event Tracking
- Custom events work on all subdomains
- User identification persists across subdomains
- User properties sync across subdomains
- Events appear in real-time dashboard
Advanced Configuration
Custom Cookie Domain
If you need to override the automatic domain detection:Subdomain-Specific Tracking
Track which subdomain each event originated from:Next Steps
Privacy Compliance
Learn how to manage cookies and comply with GDPR/CCPA.
Troubleshooting
Resolve common tracking issues and debugging tips.