Let’s be real: trying to get accurate cross-domain attribution in 2026 with traditional cookies is a losing battle. Privacy regulations and browser lockdowns have made them too unreliable. The right way to do this now is with federated identity. It lets a user log in once and then carries that single identity across all your different sites, giving you a consistent view of their entire journey. This also gives users a much better experience through single sign-on (SSO) and builds a durable way to understand customer touchpoints. So, how do you actually build this system to get data that’s worth a damn?
Key Takeaways
- Get a central identity provider (IdP) like Okta or Auth0 and use SAML 2.0 or OIDC to manage user sessions across every domain you own.
- Make sure your analytics platform, like Google Analytics 4 (GA4), is set up to receive and process the unique user ID that your IdP passes along, which is how you’ll unify the customer journey view.
- Your user ID generation and mapping must be absolutely consistent across every single system, otherwise you’ll get fragmented data and your attribution will be worthless.
- Constantly audit your federated identity setup and data flows to stay compliant with privacy laws like GDPR and CCPA, which are always changing, paying special attention to how you get user consent for data sharing.
- Roll this out in phases. Start with just a couple of your core domains to find and fix the inevitable integration headaches before you go company-wide.
1. Choose Your Federated Identity Provider and Protocol
Your first real decision is picking the right identity provider (IdP) and protocol, which sets the stage for everything that follows. For most companies, the choice comes down to Security Assertion Markup Language (SAML) 2.0 or OpenID Connect (OIDC). SAML 2.0 is the old reliable for enterprise SSO. It’s been around forever, has mature security, and works with almost anything. OIDC, which is built on top of OAuth 2.0, is what I usually recommend for new projects because it’s far simpler and designed for modern web apps and RESTful APIs, making life easier for your developers.
You’ll be looking at IdP platforms like Okta, Auth0, and OneLogin. They all have different customization options, developer tools, and pricing. Okta, for example, is a good choice if your company uses a ton of common enterprise applications because its pre-built integrations can save a lot of development work. Auth0, with its fantastic developer-focused APIs and SDKs, is a better fit if you’re dealing with a complicated, custom-built application environment. Your decision here needs to be based on your actual tech stack and security posture, not just the sticker price. Look past the initial quote and calculate the total cost of ownership, because developer hours and maintenance will add up fast.
Pro Tip: Before you sign a contract, run a proof-of-concept on a small handful of your apps. A POC will immediately expose the integration problems and let you test the entire user login flow from start to finish. You’ll want to watch very closely how user attributes get mapped and transformed between your apps and the IdP.
2. Configure Your Identity Provider for Cross-Domain SSO
Once you’ve picked your IdP, you’ve got to configure it to handle cross-domain single sign-on (SSO). This happens in the IdP’s admin dashboard, where you’ll define your different websites or applications as individual service providers (SPs). For every SP, you’ll need to specify a few key things:
- Redirect URIs: These are the whitelisted URLs where the IdP is allowed to send the user back after they log in. You must list every single domain and subdomain where a login might happen.
- Client ID and Client Secret (for OIDC): These are basically the username and password for your application. Protect your client secrets. They should never, ever be visible in client-side code.
- Metadata URL (for SAML): SAML works by exchanging XML metadata files that contain configuration info. Your IdP will give you a URL for its metadata that your applications will use to configure themselves.
For example, in Auth0, you’d go to “Applications” and set up a new application for each domain. Inside that configuration, you’d add all the “Allowed Callback URLs,” like https://www.yourdomain.com/auth/callback and https://shop.yourdomain.net/auth/callback. This tells Auth0 exactly where it’s safe to redirect users. People mess this up all the time by forgetting a subdomain or a custom vanity URL, which just results in login errors that are a pain to debug.
Common Mistake: Getting redirect URIs wrong is the #1 cause of SSO failures. Be obsessive about checking them, trailing slashes, query params, everything, to make sure they’re an exact match for what your app sends.
3. Implement Client-Side Authentication Across Domains
With the IdP configured, it’s time to get your web applications to actually use it. This usually means grabbing an SDK or library from your IdP. For an OIDC flow, it generally works like this:
- A user hits a protected page or clicks “Login” on one of your sites, and your app redirects them to your IdP’s authorization URL. The redirect includes parameters like your
client_id, theredirect_uri, the requestedscope(likeopenid profile email), and theresponse_type(usuallycode). - The user logs in with the IdP (if they aren’t already logged in from a previous session).
- The IdP sends the user back to the
redirect_uriyou specified, but with an authorization code tacked onto the URL. - Your app’s backend takes that code and exchanges it for an ID Token and an Access Token by making a direct, server-to-server call to the IdP’s token endpoint. That ID Token has the user info you need for attribution.
The magic for cross-domain tracking happens because the IdP maintains the user’s session. Once they log in on one site, they’re already authenticated for your other properties. When they navigate to another one of your domains that uses the same IdP, they’re often silently re-authenticated in the background without having to type their password again. It’s that frictionless jump that lets you track the user consistently. For front-end heavy apps, libraries like auth0-spa-js or an equivalent from your IdP make this integration work much easier. Just don’t be sloppy with token storage. Use secure, HTTP-only cookies or, for short-lived tokens, browser memory to protect against XSS attacks.
4. Extract and Standardize User Identifiers for Analytics
When your server gets the ID Token back from the IdP, it’s time to find the one thing that matters for attribution: a stable, persistent user identifier. In an OIDC ID Token, this is almost always the sub (subject) claim, though it might be a different attribute in a SAML assertion. This ID has to be unique, pseudonymized, and absolutely identical for a user no matter which of your domains they log into. If the `sub` claim for a user on `yourdomain.com` is different from their `sub` claim on `shop.yourdomain.net`, the whole system is broken.
After you’ve validated the token on your backend, you need to push this user ID to your analytics platform. For Google Analytics 4 (GA4), this means setting the user_id parameter on all your events. Using the gtag.js library, you’d execute something like this right after a successful login:
gtag('set', {'user_id': 'USER_ID_FROM_IDP'}). Gtag('event', 'login', { 'method': 'Federated SSO'
});
This tells GA4 to tie all future events in that session to that specific user ID, no matter what domain they’re on. This is the exact mechanism that connects a user’s activity from their first visit on a marketing site to their eventual purchase on an e-commerce site. If that `user_id` isn’t consistent, and I’ve spent months helping clients debug attribution models only to discover their ID generation was flaky, your entire setup is useless.
5. Configure Analytics Platforms for User ID Tracking
Sending the `user_id` is only half the job. You have to make sure your analytics platform is actually set up to use it. GA4 automatically starts using the `user_id` to unify user counts and build its cross-domain reports as soon as it sees the parameter being sent. You can (and should) check that it’s working by digging into the “User Explorer” report in GA4, where you should be able to see individual user timelines identified by the `user_id` you’re sending. If you don’t see them, your data layer implementation or GA4 tag configuration is probably wrong, so get into the debug view and figure it out.
If you’re using other tools like a customer data platform (CDP) such as Segment or product analytics software like Amplitude, the principle is identical: identify the primary user ID field they expect and map your federated user ID to it. In Segment, this is done with the `analytics.identify()` call. This is where you get the real payoff, because feeding that consistent ID into a CDP creates a single source of truth for customer behavior that can then be sent to all your other downstream marketing and product tools.
Pro Tip: Implement serious error logging for both your identity and analytics integrations. Set up automated alerts for things like failed token exchanges, events with missing user IDs, or any weird discrepancies between the data your IdP reports and what you see in your analytics. These alerts will save you days of diagnostic headaches.
6. Implement Consent Management and Privacy Compliance
This is the part that can get you in real trouble. While federated identity is great for attribution, it also concentrates a lot of user data, creating significant privacy responsibilities. Your implementation absolutely must comply with regulations like GDPR, CCPA, and whatever new laws pop up next. That requires you to:
- Explicit Consent: Get clear, informed consent from users before you start tracking their activity across your domains. This means a consent banner that isn’t confusing and clearly explains what data you’re collecting and why you need it for analytics.
- Data Minimization: Only collect and share the user data that is strictly necessary for attribution. You should not send personally identifiable information (PII) directly to your analytics platforms. The federated user ID itself should be a generated UUID, not the user’s email address.
- Transparency: Your privacy policy needs to plainly state that you use federated identity to understand user journeys and explain how users can exercise their data rights (like requesting to see or delete their data).
- Data Security: All data transmissions between your apps, the IdP, and your analytics tools must be encrypted with HTTPS. No excuses. Store tokens and user IDs securely at all times.
The legal field for data privacy is a moving target. What was compliant in 2024 might not be by 2026. Don’t make the mistake of assuming that just because you’re using a “secure” IdP, your entire data flow is automatically compliant. You are the data controller, and the legal responsibility falls on you to make sure every single step adheres to modern privacy principles.
Getting federated identity right for cross-domain attribution is a big project, but it delivers an unmatched view of customer behavior. If you choose the right IdP, configure your systems with care, and treat privacy as a top-line priority from day one, you can build an accurate and resilient attribution model that actually helps you make strategic decisions.
What is the primary benefit of using federated identity for cross-domain attribution?
It gives you a single, consistent view of a user’s journey across all your different websites and apps. This lets you accurately attribute conversions and really understand how people are interacting with your brand, from the first touch on one domain to a purchase on another.
Can I use federated identity without implementing single sign-on (SSO)?
Theoretically, yes. The key part for attribution is the persistent user ID it generates. You could use the identity provider just to create that consistent ID for tracking without fully implementing a smooth SSO experience, but you’d be throwing away one of the biggest benefits for your users.
What are the main security considerations when implementing federated identity?
You have to lock down your client secrets, use HTTPS for everything, and validate ID tokens and SAML assertions on your server to prevent tampering. Securely storing access and refresh tokens is huge, as is preventing replay attacks. It’s also critical to use the claims from the IdP to manage access control properly and to audit your security configurations constantly.
How does federated identity handle users who don’t log in?
It doesn’t. This setup only works for authenticated users. For anonymous visitors, you still have to rely on things like first-party cookies (where they’re allowed) to track their behavior within a single domain. A good strategy is to link an anonymous session to the federated user ID as soon as the user logs in, which connects their pre-login activity to their identified profile.
What’s the difference between SAML 2.0 and OpenID Connect for this purpose?
SAML 2.0 is the older, XML-based standard that’s common in enterprise SSO. OpenID Connect (OIDC) is a newer identity layer built on OAuth 2.0 that uses JSON Web Tokens (JWTs), which makes it much more lightweight and developer-friendly for modern web and mobile apps. Both can give you the persistent user ID you need for attribution, but OIDC usually integrates more cleanly with modern analytics stacks because it’s all JSON-based.