PostHog Analytics Automation

This n8n workflow automates PostHog analytics, tracking events, identities, and page views via its API. Key nodes include Webhook (receives POST requests), Input Validation (sets parameters), Prepare Analytics Data (formats input), Create Event, Create Identity, Create Alias, Track Page View, Track Screen View (API interactions), Process Analytics Results (data processing), and Success/Error Response nodes (handle outputs). Set up Requirements and Configuration: Install n8n by downloading from n8n.io for self-hosting or sign up at cloud.n8n.io for cloud setup. Follow installation prompts or create a cloud account. Obtain a PostHog API key from posthog.com: log in, go to 'Project Settings' > 'Project API Keys,' and copy the key. For self-hosted PostHog, find the key in your instance’s settings. In n8n, import the provided JSON to create the workflow. Configure nodes like 'Create Event,' 'Create Identity,' 'Create Alias,' 'Track Page View,' and 'Track Screen View' with your PostHog API key under 'Credentials,' selecting 'PostHog API.' Set the Webhook node’s path to 'posthog-analytics' and ensure it accepts POST requests. The Input Validation node checks for valid operations ('analytics_tracking_cycle', 'create_event', 'create_identity', 'create_alias', 'track_operations'). Testing and Deployment Steps: Test by sending a POST request to the Webhook URL (from the Webhook node) using Postman. Example JSON body: {'operation': 'analytics_tracking_cycle', 'eventName': 'signup', 'distinctId': 'user123', 'userName': 'John Doe', 'email': 'john@example.com'}. The 'Success Response' node returns a 200 status with analytics details, or 'Invalid Input Response' (400 status) for invalid operations. If the API key is invalid, the 'Event Creation Error' or 'PostHog Operations Error' nodes return a 502 status. Activate the workflow in n8n’s interface for deployment. Monitor logs for errors like invalid keys or malformed events, and verify credentials or inputs if issues occur.

$5.49

Workflow steps: 15

Integrated apps: webhook, set, if

PostHog Analytics Automation preview