关于AMP/非AMP用户在Safari中追踪可行性的技术咨询
Great question—let’s break down what’s possible right now, based on Safari’s latest privacy rules and AMP’s tracking capabilities:
Key Context: Safari’s ITP Restrictions
First, it’s important to note that Safari’s Intelligent Tracking Prevention (ITP) still enforces strict limits on third-party cookies by default. This hasn’t changed drastically in recent updates, so cross-domain third-party tracking remains challenging.
Current Working Scenarios
Same-domain AMP/non-AMP tracking: If your AMP pages and non-AMP pages live on the same root domain (e.g.,
yourwebsite.com/ampandyourwebsite.com), you can absolutely track users consistently now.- Use
amp-analyticswith first-party configuration, and leverage first-party cookies to store custom dimensions or client IDs. Since these are first-party, Safari doesn’t block them, so you can associate behavior across AMP and non-AMP experiences seamlessly. - The AMP Client ID API is particularly useful here—it generates a persistent first-party ID that works across both AMP and non-AMP pages on the same domain.
- Use
Custom dimensions: As long as you’re passing custom dimensions within a first-party context (same domain), these will work as expected in Safari. You can include them in your
amp-analyticstriggers just like you would on non-AMP pages.
Still Restricted Scenarios
- Cross-domain third-party tracking: If you’re trying to track users across different domains (e.g., using a third-party analytics tool hosted on another domain), Safari’s ITP will still block third-party cookies. This means you can’t reliably link a user’s AMP activity to their non-AMP activity when the tracking is handled by a cross-domain service.
- Even with
amp-analytics’ third-party vendor configurations (like Google Analytics), Safari will restrict access to third-party cookies, breaking user identity persistence across AMP and non-AMP sessions.
- Even with
Workarounds to Consider
If cross-domain tracking is a must, here are some options to explore:
- Server-side tracking: Collect user behavior data on your server (using first-party cookies, IP + user agent fingerprinting, or the AMP Client ID passed to your backend) and aggregate it there. This avoids client-side third-party cookie restrictions.
- Privacy Sandbox technologies: Tools like the Topics API or Attribution Reporting API (part of Google’s Privacy Sandbox) are being rolled out as alternatives to third-party cookies. AMP has started adding support for these, though adoption and Safari compatibility are still evolving.
Final Verdict
If your tracking is limited to a single domain, your original setup (amp-analytics + custom dimensions) should work perfectly in Safari now. For cross-domain third-party tracking, the restrictions are still in place, and you’ll need to rely on workarounds like server-side tracking or emerging privacy-focused APIs.
内容的提问来源于stack exchange,提问作者hasche90

