Analytics & Attribution User Guide
1. Executive Summary
The Aegis Analytics module is a high-performance telemetry engine designed to solve the "data gap" in modern E-commerce. By combining server-side webhook ingestion with real-time edge tracking, it provides a 100% accurate view of your marketing performance, bypassing browser ad-blockers and iOS privacy restrictions.
2. Managing Paid Channels
To keep your dashboard clean and focused on ROI, Aegis uses a Marketing Channels system.
Why Register Channels?
Aegis tracks every click, including bot traffic, internal testing, and random referrals. Registering your paid channels (Google Ads, Meta, TikTok, etc.) allows the dashboard to:
- Filter Noise: Focus only on traffic that matters to your bottom line.
- Normalize Data: Group various referral strings into a single, clean channel name.
- Calculate Attribution: Correctively attribute conversions to the right paid source.
How to Register a Channel
- Navigate to Settings > Analytics > Marketing Channels in the Admin Panel.
- Press Add channel and, in the modal, add the Source Name (e.g.,
google,tiktok,snapchat). Each channel is a subdomain the router answers on, such asmeta.purdyandfigg.com. - Assign a Default Medium (typically
paid_socialorcpc). - Once added, the dashboard will immediately begin grouping historical and future data under these official headers.
Built-in sources: direct and facebook
Two sources show as channels without being registered, and must not be added here (a channel is a subdomain, and an inactive one redirects):
- direct: a visit with no tag, including one straight to a landing page.
- facebook: Meta's ads, which send
utm_source=facebookand land on the landing page's own domain. It is not renamed tometa, which is the subdomain.
Both appear in Hits by Channel (direct as one row whatever its medium), in the channel picker, and in the touchpoint count. facebook counts as paid in Edge Clicks; direct does not.
3. The Analytics Dashboard
The dashboard provides real-time visibility into the health of your marketing funnel.
Key Performance Indicators (KPIs)
- Click Velocity: Monitor traffic spikes in real-time across Today, 7-Day, and 30-Day windows.
- GA4 Firing Rate: A critical health metric showing the % of clicks where the GA4 server-side signal was successfully dispatched. If this drops below 95%, it indicates a potential configuration issue.
- UTM Coverage: Tracks how much of your traffic is properly tagged. High "Untagged" traffic suggests your ad creative team needs to audit their tracking templates.
Advanced Attribution Models
- Customer Touchpoints: See a distribution of how many visits it takes for a customer to convert. This helps understand the length of your sales cycle.
- Session Distribution: Analyze how often customers return to your site, helping you distinguish between new acquisition and returning brand loyalty.
- Entry Points: The host each visit arrived on (
meta.,get., or a landing page's own address) beside the source it was filed under, with visits and unique visitors. A visit straight to a landing page shows asdirecton that page's host. "Not recorded" is a visit from before 2 November 2026, when the host started being stored. It follows the campaign and channel filters.
Filtering by channel
The channel picker lists every row in Hits by Channel that has clicks in the date range: the active registered channels plus direct and facebook. Picking a campaign narrows it to the channels that campaign ran on. Every panel except Hits by Channel follows it. The campaign list includes campaigns from direct and facebook too, so Meta's numeric ad IDs appear there.
With direct picked, Performance by Page Type reads the daily totals, which have always counted direct. The other panels read individual visits, and direct visits were not recorded one by one between 6 September and 2 November 2026, so over a range that includes that gap they show far fewer.
Visitor Explorer
Lists every visitor in the date range, whatever their source: tagged, facebook, or direct. Use the source filter to narrow it.
4. Performance by Page Type
Aegis categorizes every route (Home, Collection, Product, Search, etc.) to show you where your revenue is actually coming from.
- Revenue vs. Clicks: Identify "high-intent" page types that generate revenue despite lower traffic.
- Optimization: Use these insights to decide which page types need speed optimizations or better UX to maximize their conversion potential.
5. Data Export & Integration
For teams using specialized BI tools (Tableau, PowerBI) or custom Python models, Aegis provides a high-performance export API.
Automated Exports
Use the GET /api/analytics/export endpoint to pull raw CSV or JSON data directly
into your workflows. Access is restricted to superadmins or a valid app token.
- Auth — any one of:
Authorization: Bearer <token>(recommended for session-less access)- the
proxyAdminTokencookie ?token=<token>on the query string
- Parameters:
start/end— accepts eitherYYYY-MM-DDor a full ISO timestamp. Defaults to the last 7 days.source— exact source (meta,google,facebook…)medium— exact medium (paid_social,cpc…)campaign— partial match on campaign name or pathcampaign_exact— one campaign by its exact name, from the campaign list belowpage— one proxied page, such asautumn-juggler, from the page list belowentry— the host the click arrived on, such asget.purdyandfigg.com(straight to the landing page) ormeta.purdyandfigg.com(via the subdomain)include_direct=1— include untagged visits too (orsource=directfor those alone)limit— default 1,000, maximum 10,000cursor— for paging a date range:meta.next_cursorfrom the last pageoffset— the old way to page; slower the deeper it goes, so usecursorsince_id— sync mode: only rows added after this id (see below)format—csvorjson(defaultjson)
Only what's new: since_id
For a regular pull, keep a watermark instead of re-reading a date range:
- First run:
since_id=0(plusstartif you don't want older history). - Each response's
meta.next_since_idis your new watermark; send it back assince_iduntilhas_moreis false. - Save the last one. Next run starts from it and returns only rows added since, oldest first.
It goes by row id, not time, so a click recorded late is never skipped. Aegis
keeps no record of what you've fetched: to re-read, send an older id. In CSV the
watermark is in the X-Next-Since-Id and X-Has-More headers.
The campaign list
GET /api/analytics/campaigns lists every campaign with its source, medium,
clicks, and first and last day seen, newest first. Optional: start / end
(YYYY-MM-DD), source, and q for part of a name. It reads the daily
totals, so it's cheap to call. Pass a name from it to the export as
campaign_exact; a click with no campaign is listed as unknown. The list counts
every click, but the export only has rows while Log Analytics is on.
The page list
GET /api/analytics/pages lists every proxied page (not archived) with its
store and whether it's live. Optional: store, and q for part of a path. Pass
a page from it to the export, e.g. page=autumn-juggler; slashes don't
matter.
Every tagged click is exported, whatever its source: a subdomain channel such as
meta, or the utm_source an ad link sends, such as facebook from Meta's ads.
Untagged traffic (direct) is left out. The campaign list works the same way.
Each row has entry_host, the host the visit arrived on. A visit straight to a
landing page (no subdomain, no utm_source) is recorded too, as direct, so
someone who clicks an ad and later comes back by typing the address shows both
visits. Rows from before 2 November 2026 have no entry_host, and direct visits
before then were counted in the daily totals but mostly not recorded one by one.
6. Server-Side CAPI & GA4
Aegis automatically handles the heavy lifting of sending data to ad networks:
- Meta CAPI: Every purchase is sent directly to Meta's servers with advanced matching keys to maximize your ad bidding efficiency.
- GA4 Measurement Protocol: Conversion events are dispatched server-side, ensuring that your Google Analytics data matches your internal database exactly.
7. User & Session Tracking
Aegis uses a multi-layered identity system to track the user journey with 100% precision, even across refreshes and deep-linked navigation.
Identity Tokens
- Client ID (
client_id): Derived from the standard Google Analytics_gacookie. If blocked, a random UUID is generated to maintain tracking integrity. - Session ID (
session_id): Stored in theaegis_sidcookie. This persists for the duration of the browser session and groups individual clicks into a single visit. - Visitor ID (
visitor_id): Stored in theaegis_vidcookie. This is a long-term identifier (2-year expiry) that allows Aegis to recognize returning customers even months later.
Session Persistence & URL Restoration
To solve the common problem of "lost UTMs" on page refreshes or internal links, Aegis implements Session Persistence:
- KV Locking: The first time a user lands from an ad, their marketing source is "locked" into a server-side session store (Cloudflare KV).
- URL Restoration: If a user refreshes their page and the UTMs disappear from the address bar, Aegis automatically restores them from the session store.
- Attribution Continuity: This ensures that downstream tools (like Shopify checkout) always receive the correct
utm_sourceregardless of how the user navigated through the site.
7.3 GA Firing Verification (ga_fired)
Aegis provides a unique health metric called GA Firing Verification to measure the "tracking gap" between server-side logs and browser-side analytics.
- How it works: When a user lands, the server logs a "Pending" event (
ga_fired = 0). Once the GA4 script successfully loads and fires in the user's browser, a hidden heartbeat signal is sent back to Aegis to update the record toga_fired = 1. - Interpreting the Data:
- Success (1): Confirms that the user's browser is not blocking your tracking and GA4 has recorded the visit.
- Failure (0): Indicates that the user is likely using an Ad-Blocker, a privacy-focused browser (like Brave), or they closed the page before GA4 could load.
- Dashboard View: In the Visitor Explorer, events with a green checkmark signify a successful GA fire, while orange indicators highlight users who are "invisible" to standard Google Analytics.