如何在Google Analytics中统计Facebook特定UTM链接的唯一页面浏览量
Got it, let's walk through exactly how to track those unique page views from your Facebook UTM campaign, while filtering out any non-campaign traffic like direct returns later on.
Option 1: Use Google Analytics 4 (GA4) Native Filtering
First, make sure your Facebook link has complete UTM parameters to avoid ambiguity. I'd recommend filling out the full set like this:https://mypage.com?utm_source=facebook&utm_medium=social&utm_campaign=mycampaign
Adding utm_source and utm_medium helps GA4 clearly distinguish this traffic from other sources.
Then build a custom report to isolate the campaign traffic:
- Go to GA4's Explorations page and create a new Free Form exploration
- Add these dimensions:
Page path,UTM Campaign,UTM Source - Add your preferred metric:
- Use Unique Page Views if you want to count a user's first view of a page (from the campaign) only once per session
- Use Page Views if you want to count every time someone lands on a page via the campaign link, even if the same user clicks it multiple times
- Add filters:
UTM CampaignequalsmycampaignANDUTM Sourceequalsfacebook - This report will automatically exclude any direct visits or non-campaign traffic, since those won't have the matching UTM parameters attached.
Option 2: Custom Code Tracking (For Self-Hosted Analytics)
If you're running your own stats system, you can add frontend code to track this precisely:
- When the page loads, check if the URL's query string includes
utm_campaign=mycampaign - If it does:
- (Optional) Set a session-level cookie (e.g.,
campaign_mycampaign=visited) to track that this user came via the campaign in their current session - Send a tracking event to your analytics backend, tagging it with the
mycampaignchannel
- (Optional) Set a session-level cookie (e.g.,
- To exclude subsequent direct visits, only send the tracking event when the UTM parameter is present in the URL. This way, even if the user returns directly later (without the UTM link), those views won't be counted toward the campaign.
If you need true "unique page views" (counting a user's first campaign-driven view of a page only once over a set period), extend the cookie's expiration (e.g., 7 days) and check if the user has already triggered a tracking event for that page + campaign before sending a new one.
Key Notes
- For single-page apps (SPAs), make sure your routing setup preserves URL query parameters—otherwise the UTM tags might get lost when users navigate around your site.
- If you want to exclude in-session repeat views (e.g., a user clicks the campaign link, navigates away, then comes back to the same page within the same session), use GA4's First Page View metric or add logic in your custom code to check if it's the first load of the page in the current session.
内容的提问来源于stack exchange,提问作者lopesa

