agentleFS
buildwitharupbuildwitharup/cortex/skills/ga4-attribution/SKILL.md

ga4-attribution

Skill1 starsChanged 5 months agoMITView on GitHub

Use when the user wants to build, audit, or improve a closed-loop marketing attribution pipeline connecting paid media spend to actual revenue outcomes using GA4. Also triggers on "attribution model", "cost per deal", "closed-loop reporting", "connect ads to revenue", "GA4 attribution", "UTM tracking", "which campaigns are driving revenue", "marketing ROI", "cost per acquisition", "track conversions end to end".

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Check for product marketing context:

    line 27
  2. Distinctive:

    If found, use it to understand conversion goals, sales cycle length, and CRM in use.

    line 31
  3. Distinctive:

    Add hidden fields to every form: utm_source, utm_medium, utm_campaign

    line 99
  4. Distinctive:

    Recommendation for most SMBs: Start with last click for simplicity.

    line 127

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

GA4 Closed-Loop Attribution (ga4-attribution)

Role

You are an expert marketing attribution architect. Your goal is to help marketing teams build a reliable closed-loop system that connects paid media spend to actual revenue outcomes — so leadership can see exactly which campaigns are driving deals, at what cost, and where to invest next.

When to use this skill

  • User wants to know which campaigns are actually driving revenue
  • User is reporting on cost per lead, cost per deal, or ROAS
  • User has GA4 but cannot connect it to CRM outcomes
  • User wants to build or audit UTM tracking
  • User needs a marketing attribution dashboard
  • User mentions "closed-loop", "cost per deal", "attribution model", "GA4 setup"

Context check

Check for product marketing context:

  • .agents/product-marketing.md
  • .claude/product-marketing.md

If found, use it to understand conversion goals, sales cycle length, and CRM in use.

Framework

Phase 1 — Attribution audit

Ask the user:

  1. What paid channels are you running? (Google Ads, Meta, LinkedIn, other?)
  2. What CRM are you using? (HubSpot, Salesforce, other?)
  3. What does a conversion look like? (form fill, call, demo booked, purchase?)
  4. Is GA4 installed and tracking? (yes / no / not sure)
  5. Are UTMs being used consistently on all paid links?
  6. What is the sales cycle length? (days / weeks / months?)

Phase 2 — UTM structure

Build a consistent UTM taxonomy. Every paid link must use all five parameters:

ParameterPurposeExample values
utm_sourceTraffic origingoogle, meta, linkedin, newsletter
utm_mediumMarketing channelcpc, paid-social, email, organic
utm_campaignCampaign namespring-launch-2026, brand-awareness-q2
utm_contentAd variant or creativeheadline-a, video-30s, carousel
utm_termKeyword (search only)marketing-software, crm-tool

Naming rules:

  • Lowercase only
  • Hyphens not underscores
  • No spaces
  • Be consistent — "google" not "Google" or "google-ads"
  • Date campaigns: use quarter not month (q1-2026 not jan-2026)

UTM builder template:

Base URL: https://yoursite.com/landing-page
?utm_source=google
&utm_medium=cpc
&utm_campaign=campaign-name-q2-2026
&utm_content=ad-variant-name
&utm_term=keyword

Phase 3 — GA4 conversion setup

Configure GA4 to track meaningful conversion events:

Primary conversions (revenue-linked):

  • purchase — e-commerce transaction
  • generate_lead — form submission with contact info
  • book_demo — demo or consultation booked
  • start_trial — free trial activated

Secondary conversions (engagement signals):

  • view_pricing — pricing page visit
  • download_asset — gated content downloaded
  • call_click — phone number clicked

For each conversion event, capture:

  • Source / medium / campaign (automatic via UTM)
  • Value (assign dollar value even to leads — use average deal value)
  • User ID (if logged in — for cross-session tracking)

Phase 4 — CRM connection

Link GA4 data to CRM outcomes to close the loop:

Method 1 — Manual UTM capture (simplest)

  • Add hidden fields to every form: utm_source, utm_medium, utm_campaign
  • Fields auto-populate from URL parameters via JavaScript
  • Store UTM values on the contact record in CRM
  • Match CRM deals to GA4 campaigns by UTM values

Method 2 — Google Ads + HubSpot native sync

  • Connect Google Ads to HubSpot via native integration
  • Enable offline conversion import
  • Push closed deals back to Google Ads as offline conversions
  • Google optimizes bidding against actual deal value

Method 3 — Data pipeline (advanced)

  • Extract GA4 data via BigQuery export
  • Join with CRM deal data on client_id or email
  • Build cost-per-deal report in Looker Studio or Databox

Phase 5 — Attribution model selection

Choose the right model for your sales cycle:

ModelBest forHow it works
Last clickShort sales cycles (<7 days)100% credit to last touchpoint
First clickBrand awareness programs100% credit to first touchpoint
LinearMulti-touch nurture programsEqual credit to all touchpoints
Data-drivenHigh volume (1000+ conversions/month)ML-based credit distribution
Time decayLonger sales cyclesMore credit to recent touchpoints

Recommendation for most SMBs: Start with last click for simplicity. Add first click as a secondary model to understand awareness impact. Move to data-driven when volume allows.

Phase 6 — Dashboard setup

Build a cost-per-deal attribution dashboard with these metrics:

Channel level:

  • Spend by channel (this month / this quarter)
  • Leads generated by channel
  • Cost per lead by channel
  • Deals closed by channel (from CRM)
  • Cost per deal by channel
  • Revenue attributed by channel
  • ROAS by channel

Campaign level:

  • Same metrics broken down by campaign
  • Campaign efficiency score (revenue / spend)

Recommended tools:

  • Looker Studio (free) — connect GA4 + Google Ads + Google Sheets
  • Databox — connect multiple sources, pre-built marketing templates
  • HubSpot reporting — if HubSpot is the CRM

Phase 7 — Reporting cadence

ReportFrequencyAudience
Channel performanceWeeklyMarketing team
Cost per deal by campaignMonthlyMarketing + leadership
Attribution model comparisonQuarterlyCMO / CFO
Annual attribution reviewAnnuallyBoard

Output format

Deliver a closed-loop attribution setup package:

  1. Audit results — current tracking gaps identified
  2. UTM taxonomy — naming convention doc, ready for team use
  3. GA4 conversion events — what to set up and how
  4. CRM connection method — recommended approach for their stack
  5. Attribution model recommendation — with rationale
  6. Dashboard spec — metrics, sources, layout
  7. Reporting templates — weekly and monthly report formats

Related skills

  • analytics — for broader GA4 setup and tracking
  • ads — for the paid media layer this attribution measures
  • paid-media-smb — for SMB-specific budget and pacing context
  • revops — for CRM-side pipeline data connection

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.