analytics

When the user wants to set up, improve, or audit analytics tracking and measurement. Also use when the user mentions "set up tracking," "GA4," "Google Analytics," "conversion tracking," "event tracking," "UTM parameters," "tag manager," "GTM," "analytics implementation," "tracking plan," "how do I measure this," "track conversions," "Mixpanel," "Segment," "are my events firing," or "analytics isn't working." Use this whenever someone asks how to know if something is working or wants to measure marketing results. For choosing attribution models, comparing multi-touch/MMM/incrementality, or reconciling conflicting numbers across tools, see attribution. For A/B test measurement, see ab-testing.

Analytics Tracking

You are an expert in analytics implementation and measurement. Your goal is to help set up tracking that provides actionable insights for marketing and product decisions.

Initial Assessment

Check for product marketing context first: If .agents/product-marketing.md exists (or .claude/product-marketing.md, or the legacy product-marketing-context.md filename, in older setups), read it before asking questions. Use that context and only ask for information not already covered or specific to this task.

Before implementing tracking, understand:

  1. Business Context - What decisions will this data inform? What are key conversions?
  2. Current State - What tracking exists? What tools are in use?
  3. Technical Context - What's the tech stack? Any privacy/compliance requirements?

Core Principles

1. Track for Decisions, Not Data

2. Start with the Questions

3. Name Things Consistently

4. Maintain Data Quality


Tracking Plan Framework

Structure

B0

Event Types

TypeExamples
PageviewsAutomatic, enhanced with metadata
User ActionsButton clicks, form submissions, feature usage
System EventsSignup completed, purchase, subscription changed
Custom ConversionsGoal completions, funnel stages

For comprehensive event lists: See references/event-library.md


Event Naming Conventions

B1

Best Practices


Essential Events

Marketing Site

EventProperties
cta_clickedbutton_text, location
form_submittedform_type
signup_completedmethod, source
demo_requested-

Product/App

EventProperties
onboarding_step_completedstep_number, step_name
feature_usedfeature_name
purchase_completedplan, value
subscription_cancelledreason

For full event library by business type: See references/event-library.md


Event Properties

Standard Properties

CategoryProperties
Pagepage_title, page_location, page_referrer
Useruser_id, user_type, account_id, plan_type
Campaignsource, medium, campaign, content, term
Productproduct_id, product_name, category, price

Best Practices


GA4 Implementation

Quick Setup

  1. Create GA4 property and data stream
  2. Install gtag.js or GTM
  3. Enable enhanced measurement
  4. Configure custom events
  5. Mark conversions in Admin

Custom Event Example

B2

For detailed GA4 implementation: See references/ga4-implementation.md


Google Tag Manager

Container Structure

ComponentPurpose
TagsCode that executes (GA4, pixels)
TriggersWhen tags fire (page view, click)
VariablesDynamic values (click text, data layer)

Data Layer Pattern

B3

For detailed GTM implementation: See references/gtm-implementation.md


UTM Parameter Strategy

Standard Parameters

ParameterPurposeExample
utm_sourceTraffic sourcegoogle, newsletter
utm_mediumMarketing mediumcpc, email, social
utm_campaignCampaign namespring_sale
utm_contentDifferentiate versionshero_cta
utm_termPaid search keywordsrunning+shoes

Naming Conventions


Debugging and Validation

Testing Tools

ToolUse For
GA4 DebugViewReal-time event monitoring
GTM Preview ModeTest triggers before publish
Browser ExtensionsTag Assistant, dataLayer Inspector

Validation Checklist

Common Issues

IssueCheck
Events not firingTrigger config, GTM loaded
Wrong valuesVariable path, data layer structure
Duplicate eventsMultiple containers, trigger firing twice

Privacy and Compliance

Considerations

Implementation


Output Format

Tracking Plan Document

B4


Task-Specific Questions

  1. What tools are you using (GA4, Mixpanel, etc.)?
  2. What key actions do you want to track?
  3. What decisions will this data inform?
  4. Who implements - dev team or marketing?
  5. Are there privacy/consent requirements?
  6. What's already tracked?

Tool Integrations

For implementation, see the tools registry. Key analytics tools:

ToolBest ForMCPGuide
GA4Web analytics, Google ecosystem✓ga4.md
MixpanelProduct analytics, event tracking-mixpanel.md
AmplitudeProduct analytics, cohort analysis-amplitude.md
PostHogOpen-source analytics, session replay-posthog.md
SegmentCustomer data platform, routing-segment.md


References

Event Library

event-library.md

Event Library Reference

Comprehensive list of events to track by business type and context.

Contents

Marketing Site Events

Event NameDescriptionProperties
page_viewPage loaded (enhanced)page_title, page_location, content_group
scroll_depthUser scrolled to thresholddepth (25, 50, 75, 100)
outbound_link_clickedClick to external sitelink_url, link_text
internal_link_clickedClick within sitelink_url, link_text, location
video_playedVideo startedvideo_id, video_title, duration
video_completedVideo finishedvideo_id, video_title, duration

CTA & Form Interactions

Event NameDescriptionProperties
cta_clickedCall to action clickedbutton_text, cta_location, page
form_startedUser began formform_name, form_location
form_field_completedField filledform_name, field_name
form_submittedForm successfully sentform_name, form_location
form_errorForm validation failedform_name, error_type
resource_downloadedAsset downloadedresource_name, resource_type

Conversion Events

Event NameDescriptionProperties
signup_startedInitiated signupsource, page
signup_completedFinished signupmethod, plan, source
demo_requestedDemo form submittedcompany_size, industry
contact_submittedContact form sentinquiry_type
newsletter_subscribedEmail list signupsource, list_name
trial_startedFree trial beganplan, source

Product/App Events

Onboarding

Event NameDescriptionProperties
signup_completedAccount createdmethod, referral_source
onboarding_startedBegan onboarding-
onboarding_step_completedStep finishedstep_number, step_name
onboarding_completedAll steps donesteps_completed, time_to_complete
onboarding_skippedUser skipped onboardingstep_skipped_at
first_key_action_completedAha moment reachedaction_type

Core Usage

Event NameDescriptionProperties
session_startedApp session begansession_number
feature_usedFeature interactionfeature_name, feature_category
action_completedCore action doneaction_type, count
content_createdUser created contentcontent_type
content_editedUser modified contentcontent_type
content_deletedUser removed contentcontent_type
search_performedIn-app searchquery, results_count
settings_changedSettings modifiedsetting_name, new_value
invite_sentUser invited othersinvite_type, count

Errors & Support

Event NameDescriptionProperties
error_occurredError experiencederror_type, error_message, page
help_openedHelp accessedhelp_type, page
support_contactedSupport request madecontact_method, issue_type
feedback_submittedUser feedback givenfeedback_type, rating

Monetization Events

Pricing & Checkout

Event NameDescriptionProperties
pricing_viewedPricing page seensource
plan_selectedPlan chosenplan_name, billing_cycle
checkout_startedBegan checkoutplan, value
payment_info_enteredPayment submittedpayment_method
purchase_completedPurchase successfulplan, value, currency, transaction_id
purchase_failedPurchase failederror_reason, plan

Subscription Management

Event NameDescriptionProperties
trial_startedTrial beganplan, trial_length
trial_endedTrial expiredplan, converted (bool)
subscription_upgradedPlan upgradedfrom_plan, to_plan, value
subscription_downgradedPlan downgradedfrom_plan, to_plan
subscription_cancelledCancelledplan, reason, tenure
subscription_renewedRenewedplan, value
billing_updatedPayment method changed-

E-commerce Events

Browsing

Event NameDescriptionProperties
product_viewedProduct page viewedproduct_id, product_name, category, price
product_list_viewedCategory/list viewedlist_name, products[]
product_searchedSearch performedquery, results_count
product_filteredFilters appliedfilter_type, filter_value
product_sortedSort appliedsort_by, sort_order

Cart

Event NameDescriptionProperties
product_added_to_cartItem addedproduct_id, product_name, price, quantity
product_removed_from_cartItem removedproduct_id, product_name, price, quantity
cart_viewedCart page viewedcart_value, items_count

Checkout

Event NameDescriptionProperties
checkout_startedCheckout begancart_value, items_count
checkout_step_completedStep finishedstep_number, step_name
shipping_info_enteredAddress enteredshipping_method
payment_info_enteredPayment enteredpayment_method
coupon_appliedCoupon usedcoupon_code, discount_value
purchase_completedOrder placedtransaction_id, value, currency, items[]

Post-Purchase

Event NameDescriptionProperties
order_confirmedConfirmation viewedtransaction_id
refund_requestedRefund initiatedtransaction_id, reason
refund_completedRefund processedtransaction_id, value
review_submittedProduct reviewedproduct_id, rating

B2B / SaaS Specific Events

Team & Collaboration

Event NameDescriptionProperties
team_createdNew team/org madeteam_size, plan
team_member_invitedInvite sentrole, invite_method
team_member_joinedMember acceptedrole
team_member_removedMember removedrole
role_changedPermissions updateduser_id, old_role, new_role

Integration Events

Event NameDescriptionProperties
integration_viewedIntegration page seenintegration_name
integration_startedSetup beganintegration_name
integration_connectedSuccessfully connectedintegration_name
integration_disconnectedRemoved integrationintegration_name, reason

Account Events

Event NameDescriptionProperties
account_createdNew accountsource, plan
account_upgradedPlan upgradefrom_plan, to_plan
account_churnedAccount closedreason, tenure, mrr_lost
account_reactivatedReturned customerprevious_tenure, new_plan

Event Properties (Parameters)

Standard Properties to Include

User Context:

B0

Session Context:

B1

Campaign Context:

B2

Product Context (E-commerce):

B3

Timing:

B4


Funnel Event Sequences

Signup Funnel

  1. signup_started
  2. signup_step_completed (email)
  3. signup_step_completed (password)
  4. signup_completed
  5. onboarding_started

Purchase Funnel

  1. pricing_viewed
  2. plan_selected
  3. checkout_started
  4. payment_info_entered
  5. purchase_completed

E-commerce Funnel

  1. product_viewed
  2. product_added_to_cart
  3. cart_viewed
  4. checkout_started
  5. shipping_info_entered
  6. payment_info_entered
  7. purchase_completed

Ga4 Implementation

ga4-implementation.md

GA4 Implementation Reference

Detailed implementation guide for Google Analytics 4.

Contents

Configuration

Data Streams

Enhanced Measurement Events (Automatic)

EventDescriptionConfiguration
page_viewPage loadsAutomatic
scroll90% scroll depthToggle on/off
clickOutbound link click (outbound: true); cross-domain measurement domains are excludedToggle on/off
view_search_resultsSearch results page with a configured search query parameterConfigure query parameters
video_start, video_progress, video_completeEmbedded YouTube start, progress and completionToggle on/off; JS API support required
file_downloadPDF, docs, etc.Configurable extensions

Use these exact names in event filters and triggers. The option labels "outbound clicks", "site search" and "video engagement" are not automatic event names. For video, report starts, progress milestones and completions separately; adding all three counts double-counts a viewing journey. A custom event with one of the old labels needs its own implementation. Verify enabled options and observed parameters in DebugView before expecting data.

Contract: Google enhanced measurement events.

Use Google's predefined events when possible for enhanced reporting:

All properties:

E-commerce:

Games:

Reference: https://support.google.com/analytics/answer/9267735


Custom Events

gtag.js Implementation

B0

Google Tag Manager (dataLayer)

B1


Conversions Setup

Creating Conversions

  1. Collect the event - Ensure event is firing in GA4
  2. Mark as conversion - Admin > Events > Mark as conversion
  3. Set counting method:
  1. Import to Google Ads - For conversion-optimized bidding

Conversion Values

B2

Or set default value in GA4 Admin when marking conversion.


Custom Dimensions and Metrics

When to Use

Custom dimensions:

Custom metrics:

Setup Steps

  1. Admin > Data display > Custom definitions
  2. Create dimension or metric
  3. Choose scope:
  1. Enter parameter name (must match event parameter)

Examples

DimensionScopeParameterDescription
User TypeUseruser_typeFree, trial, paid
Content AuthorEventauthorBlog post author
Product CategoryItemitem_categoryE-commerce category

Audiences

Creating Audiences

Admin > Data display > Audiences

Use cases:

Audience Examples

High-intent visitors:

Engaged users:

Purchasers:


Debugging

DebugView

Enable with:

View at: Reports > Configure > DebugView

Real-Time Reports

Check events within 30 minutes: Reports > Real-time

Common Issues

Events not appearing:

Parameter values missing:

Conversions not recording:


Data Quality

Filters

Admin > Data streams > [Stream] > Configure tag settings > Define internal traffic

Exclude:

Cross-Domain Tracking

For multiple domains sharing analytics:

  1. Admin > Data streams > [Stream] > Configure tag settings
  2. Configure your domains
  3. List all domains that should share sessions

Session Settings

Admin > Data streams > [Stream] > Configure tag settings


Integration with Google Ads

Linking

  1. Admin > Product links > Google Ads links
  2. Enable auto-tagging in Google Ads
  3. Import conversions in Google Ads

Audience Export

Audiences created in GA4 can be used in Google Ads for:

Gtm Implementation

gtm-implementation.md

Google Tag Manager Implementation Reference

Detailed guide for implementing tracking via Google Tag Manager.

Contents

Container Structure

Tags

Tags are code snippets that execute when triggered.

Common tag types:

Triggers

Triggers define when tags fire.

Built-in triggers:

Custom triggers:

Variables

Variables capture dynamic values.

Built-in (enable as needed):

User-defined:


Naming Conventions

B0


Data Layer Patterns

Basic Structure

B1

Page Load Data

B2

Form Submission

B3

Button Click

B4

E-commerce Events

B5


Common Tag Configurations

GA4 Configuration Tag

Tag Type: Google Analytics: GA4 Configuration

Settings:

Trigger: All Pages

GA4 Event Tag

Tag Type: Google Analytics: GA4 Event

Settings:

Trigger: Custom Event with event name match

Facebook Pixel - Base

Tag Type: Custom HTML

B6

Trigger: All Pages

Facebook Pixel - Event

Tag Type: Custom HTML

B7

Trigger: Custom Event - form_submitted


Preview and Debug

Preview Mode

  1. Click "Preview" in GTM
  2. Enter site URL
  3. GTM debug panel opens at bottom

What to check:

Debug Tips

Tag not firing:

Wrong variable value:

Multiple firings:


Workspaces and Versioning

Workspaces

Use workspaces for team collaboration:

Version Management

Best practices:

Version notes example:

B8


B9

  1. Enable Consent Overview in Admin
  2. Configure consent for each tag
  3. Tags respect consent state automatically

Advanced Patterns

Tag Sequencing

Setup tags to fire in order: Tag Configuration > Advanced Settings > Tag Sequencing

Use cases:

Exception Handling

Trigger exceptions - Prevent tag from firing:

Custom JavaScript Variables

B10

For monetary tracking, prefer the numeric amount and currency from the application data layer. If a DOM variable is needed, have the application render data-price as an unformatted, non-negative decimal in major currency units; pass its currency separately. Do not infer the amount or currency from presentation text: parseFloat turns $1,234.56 into 1 after removing $, and localized separators have different meanings. A missing or invalid amount returns null, so skip that monetary event or diagnose it before sending; reserve 0 for an explicitly free item.


Exported from Marketing Skills on 2026-10-12