Medium

PostHog Event Tracking Setup

Set up comprehensive event tracking in PostHog without writing code. Capture user actions, identify users with properties, and track page views across your entire funnel.

Works with:PostHogPostHog

Free to start

1,000 credits included

No credit card required

Try this agent Book a demo

Setup in 10 min · Cancel anytime

Setup time

~10 min

Time saved

2-3 hrs/setup

Difficulty

Medium

Tools

1 connected

How it works

1

Identify Users

Set user properties like email, plan, and company so every event ties back to a real person

2

Capture Custom Events

Send events for signups, purchases, and feature usage with structured properties

3

Track Page Views

Record page views across your funnel with URLs, titles, and referrer data

4

Verify Setup

Get a complete summary of everything tracked so you can confirm it in the PostHog dashboard

Try asking

Set up PostHog tracking for our signup funnel: identify users by email, capture signup_started and signup_completed events, and track views on /signup and /welcome
Track purchase events in PostHog with amount, currency, and product properties for user john@example.com
Set up full event tracking for our SaaS: page views on /pricing, /signup, /dashboard, and capture feature_used events with feature name properties

View the agent prompt

See the full instructions this agent runs on — copy, edit, or customize it

Expand

The Prompt

Task

Use @PostHog/Capture EventName it "PostHog/Capture Event" and call it with @PostHog/Capture Event to send custom events for key user actions (signups, purchases, feature usage), @PostHog/Identify UserName it "PostHog/Identify User" and call it with @PostHog/Identify User to set user properties like email, plan, and company, and @PostHog/Track Page ViewName it "PostHog/Track Page View" and call it with @PostHog/Track Page View to record page views across the conversion funnel. This sets up a complete event tracking foundation in PostHog for any product or website.

Input

The user provides:

  1. A list of key user actions to track (e.g., "signup", "purchase", "feature_activated")
  2. User properties to set during identification (e.g., email, plan tier, company name)
  3. Page URLs or routes to track views for (e.g., "/pricing", "/signup", "/dashboard")
  4. A distinct user ID or email to associate events with

Example: "Set up tracking for our SaaS onboarding funnel: track page views on /pricing, /signup, and /welcome, capture signup_completed and first_project_created events, and identify the user with their email and plan tier."

Context

User Identification

  1. Use @PostHog/Identify UserName it "PostHog/Identify User" and call it with @PostHog/Identify User to set the user's distinct ID and properties
  2. Include properties like email, name, plan, company, signup date
  3. This should happen first so all subsequent events are associated with the identified user
  4. Update properties whenever they change (e.g., plan upgrade, new company name)

Event Capture

  1. Use @PostHog/Capture EventName it "PostHog/Capture Event" and call it with @PostHog/Capture Event for each key user action
  2. Include relevant properties with each event:
    • For signups: signup method, referral source, plan selected
    • For purchases: amount, currency, product, payment method
    • For feature usage: feature name, usage count, context
  3. Use consistent event naming conventions (snake_case recommended)
  4. Include timestamps and session context where available

Page View Tracking

  1. Use @PostHog/Track Page ViewName it "PostHog/Track Page View" and call it with @PostHog/Track Page View for each page in the funnel
  2. Include the full URL, page title, and any relevant UTM parameters
  3. Track views in sequence to build funnel visibility
  4. Include referrer information when available

Verification

After setting up tracking:

  • Confirm each event was captured successfully
  • Verify user properties were set correctly
  • Check that page views are recording with the right URLs
  • Summarize the complete tracking plan that was implemented

Output

Tracking Setup Summary:

User Identified:

  • Distinct ID: [user_id]
  • Properties set: [list of properties with values]

Events Captured: | Event Name | Properties | Status | |------------|-----------|--------| | [event_name] | [key properties] | Sent |

Page Views Tracked: | Page | URL | Title | Status | |------|-----|-------|--------| | [page_name] | [url] | [title] | Tracked |

Next Steps:

  • Verify events appear in PostHog dashboard within 1-2 minutes
  • Set up funnels in PostHog using the captured events
  • Create cohorts based on user properties for segmentation

WHAT ARE YOU WAITING FOR?

Ready to build?

Stop duct-taping tools.

Stop writing playbooks no one follows.

Start building agents that actually do the work—and do it well.

Cotera: For people who think busywork is boring.

"This is the best product ever when it comes to shipping. Ten on ten recommended. I just can't wait to see what happens with this product."

Rebecca Blount

Director, Customer Success