Skip to main content

posthog

Query PostHog for product analytics, create insights, dashboards, and track AI referral traffic. Auto-activates when user asks about analytics, user behavior, funnels, retention, AI traffic, or dashboards. Trigger words: "check posthog", "create insight", "analytics", "user behavior", "AI traffic", "dashboard", "funnel", "retention"

Informations de source

Dépôt
BasedHardware/omi-landing
Dernière activité de la source
23 janvier 2026 à 01:54
Langue détectée de SKILL.md
anglais
Étoiles
4
Forks
5

Options d'installation

Le prompt qui vérifie d'abord la source est sélectionné par défaut. Vous pouvez passer à une commande directe ou télécharger une copie locale.

Vérifiez les fichiers source

Lisez SKILL.md et les fichiers associés affichés par SkillsMP avant de décider de l'installer.

Affichage de SKILL.md

SKILL.md
Instructions source · Aperçu en lecture seule
name
posthog
description
Query PostHog for product analytics, create insights, dashboards, and track AI referral traffic. Auto-activates when user asks about analytics, user behavior, funnels, retention, AI traffic, or dashboards. Trigger words: "check posthog", "create insight", "analytics", "user behavior", "AI traffic", "dashboard", "funnel", "retention"
# PostHog Analytics Skill Query and manage PostHog product analytics for Mediar applications. ## Configuration **Host:** `https://eu.i.posthog.com` **Project Key (SDK):** `phc_NFSaZUao49XckpqaeyB3lIEKrFXhhXbKaI81jqZ8yn9` **Personal API Key:** Required for API operations. Read `POSTHOG_API_KEY` from `.env.local` ### Getting a Personal API Key 1. Go to https://eu.posthog.com/settings/user-api-keys 2. Click "Create personal API key" 3. Name it (e.g., "claude-code") 4. Select scopes: `insight:read`, `insight:write`, `dashboard:read`, `dashboard:write`, `query:read` 5. Add to `.env.local`: `POSTHOG_API_KEY=phx_xxx...` --- ## PowerShell Queries (Windows) Use PowerShell for all queries to avoid bash escaping issues. ### Get Project ID ```powershell powershell -Command " $token = (Get-Content .env.local | Where-Object { $_ -match '^POSTHOG_API_KEY=' }) -replace 'POSTHOG_API_KEY=', '' -replace '\"', '' $headers = @{ 'Authorization' = \"Bearer $token\" } $response = Invoke-RestMethod -Uri 'https://eu.i.posthog.com/api/projects/' -Headers $headers $response.results | ForEach-Object { Write-Host \"[$($_.id)] $($_.name)\" } " ``` ### List All Insights ```powershell powershell -Command " $token = (Get-Content .env.local | Where-Object { $_ -match '^POSTHOG_API_KEY=' }) -replace 'POSTHOG_API_KEY=', '' -replace '\"', '' $headers = @{ 'Authorization' = \"Bearer $token\" } $projectId = 'YOUR_PROJECT_ID' # Get from above query $response = Invoke-RestMethod -Uri \"https://eu.i.posthog.com/api/projects/$projectId/insights/?limit=20\" -Headers $headers $response.results | ForEach-Object { Write-Host \"[$($_.id)] $($_.name)\" Write-Host \" Type: $($_.filters.insight) | Created: $($_.created_at)\" } " ``` ### List All Dashboards ```powershell powershell -Command " $token = (Get-Content .env.local | Where-Object { $_ -match '^POSTHOG_API_KEY=' }) -replace 'POSTHOG_API_KEY=', '' -replace '\"', '' $headers = @{ 'Authorization' = \"Bearer $token\" } $projectId = 'YOUR_PROJECT_ID' $response = Invoke-RestMethod -Uri \"https://eu.i.posthog.com/api/projects/$projectId/dashboards/\" -Headers $headers $response.results | ForEach-Object { Write-Host \"[$($_.id)] $($_.name)\" Write-Host \" Tiles: $($_.tiles.Count) | Created: $($_.created_at)\" } " ``` --- ## Create Insights ### Create AI Referral Traffic Insight ```powershell powershell -Command " $token = (Get-Content .env.local | Where-Object { $_ -match '^POSTHOG_API_KEY=' }) -replace 'POSTHOG_API_KEY=', '' -replace '\"', '' $headers = @{ 'Authorization' = \"Bearer $token\" 'Content-Type' = 'application/json' } $projectId = 'YOUR_PROJECT_ID' $body = @{ name = 'AI Referral Traffic' filters = @{ insight = 'TRENDS' events = @(@{ id = '`$pageview'; type = 'events' }) properties = @{ type = 'OR' values = @( @{ key = '`$referrer'; value = 'chatgpt.com'; operator = 'icontains'; type = 'event' } @{ key = '`$referrer'; value = 'claude.ai'; operator = 'icontains'; type = 'event' } @{ key = '`$referrer'; value = 'perplexity.ai'; operator = 'icontains'; type = 'event' } @{ key = '`$referrer'; value = 'gemini.google.com'; operator = 'icontains'; type = 'event' } ) } date_from = '-30d' } } | ConvertTo-Json -Depth 10 $response = Invoke-RestMethod -Uri \"https://eu.i.posthog.com/api/projects/$projectId/insights/\" -Method POST -Headers $headers -Body $body Write-Host \"Created insight: $($response.id) - $($response.name)\" " ``` ### Create Pageviews by Page Insight ```powershell powershell -Command " $token = (Get-Content .env.local | Where-Object { $_ -match '^POSTHOG_API_KEY=' }) -replace 'POSTHOG_API_KEY=', '' -replace '\"', '' $headers = @{ 'Authorization' = \"Bearer $token\" 'Content-Type' = 'application/json' } $projectId = 'YOUR_PROJECT_ID' $body = @{ name = 'Top Pages' filters = @{ insight = 'TRENDS' events = @(@{ id = '`$pageview'; type = 'events' }) breakdown = '`$pathname' breakdown_type = 'event' date_from = '-7d' } } | ConvertTo-Json -Depth 10 $response = Invoke-RestMethod -Uri \"https://eu.i.posthog.com/api/projects/$projectId/insights/\" -Method POST -Headers $headers -Body $body Write-Host \"Created insight: $($response.id) - $($response.name)\" " ``` ### Create User Funnel Insight ```powershell powershell -Command " $token = (Get-Content .env.local | Where-Object { $_ -match '^POSTHOG_API_KEY=' }) -replace 'POSTHOG_API_KEY=', '' -replace '\"', '' $headers = @{ 'Authorization' = \"Bearer $token\" 'Content-Type' = 'application/json' } $projectId = 'YOUR_PROJECT_ID' $body = @{ name = 'Signup Funnel' filters = @{ insight = 'FUNNELS' events = @( @{ id = '`$pageview'; type = 'events'; name = 'Visit' } @{ id = 'signup_started'; type = 'events'; name = 'Start Signup' } @{ id = 'signup_completed'; type = 'events'; name = 'Complete Signup' } ) date_from = '-30d' } } | ConvertTo-Json -Depth 10 $response = Invoke-RestMethod -Uri \"https://eu.i.posthog.com/api/projects/$projectId/insights/\" -Method POST -Headers $headers -Body $body Write-Host \"Created funnel: $($response.id) - $($response.name)\" " ``` --- ## Dashboard Operations ### Create Dashboard ```powershell powershell -Command " $token = (Get-Content .env.local | Where-Object { $_ -match '^POSTHOG_API_KEY=' }) -replace 'POSTHOG_API_KEY=', '' -replace '\"', '' $headers = @{ 'Authorization' = \"Bearer $token\" 'Content-Type' = 'application/json' } $projectId = 'YOUR_PROJECT_ID' $body = @{ name = 'AI Traffic Dashboard' description = 'Track traffic from AI assistants (ChatGPT, Claude, Perplexity)' } | ConvertTo-Json $response = Invoke-RestMethod -Uri \"https://eu.i.posthog.com/api/projects/$projectId/dashboards/\" -Method POST -Headers $headers -Body $body Write-Host \"Created dashboard: $($response.id) - $($response.name)\" " ``` ### Add Insight to Dashboard ```powershell powershell -Command " $token = (Get-Content .env.local | Where-Object { $_ -match '^POSTHOG_API_KEY=' }) -replace 'POSTHOG_API_KEY=', '' -replace '\"', '' $headers = @{ 'Authorization' = \"Bearer $token\" 'Content-Type' = 'application/json' } $projectId = 'YOUR_PROJECT_ID' $dashboardId = 'YOUR_DASHBOARD_ID' $insightId = 'YOUR_INSIGHT_ID' $body = @{ tiles = @(@{ insight = $insightId }) } | ConvertTo-Json -Depth 5 $response = Invoke-RestMethod -Uri \"https://eu.i.posthog.com/api/projects/$projectId/dashboards/$dashboardId/\" -Method PATCH -Headers $headers -Body $body Write-Host \"Added insight to dashboard: $($response.name)\" " ``` --- ## Query Events (HogQL) ### Query Recent Events ```powershell powershell -Command " $token = (Get-Content .env.local | Where-Object { $_ -match '^POSTHOG_API_KEY=' }) -replace 'POSTHOG_API_KEY=', '' -replace '\"', '' $headers = @{ 'Authorization' = \"Bearer $token\" 'Content-Type' = 'application/json' } $projectId = 'YOUR_PROJECT_ID' $body = @{ query = @{ kind = 'HogQLQuery' query = 'SELECT event, properties.`$referrer` as referrer, count() as count FROM events WHERE timestamp > now() - INTERVAL 7 DAY GROUP BY event, referrer ORDER BY count DESC LIMIT 20' } } | ConvertTo-Json -Depth 5 $response = Invoke-RestMethod -Uri \"https://eu.i.posthog.com/api/projects/$projectId/query/\" -Method POST -Headers $headers -Body $body $response.results | ForEach-Object { Write-Host $_ } " ``` ### Query AI Bot Referrals ```powershell powershell -Command " $token = (Get-Content .env.local | Where-Object { $_ -match '^POSTHOG_API_KEY=' }) -replace 'POSTHOG_API_KEY=', '' -replace '\"', '' $headers = @{ 'Authorization' = \"Bearer $token\" 'Content-Type' = 'application/json' } $projectId = 'YOUR_PROJECT_ID' $body = @{ query = @{ kind = 'HogQLQuery' query = @' SELECT CASE WHEN properties.`$referrer` LIKE '%chatgpt%' OR properties.`$referrer` LIKE '%openai%' THEN 'ChatGPT' WHEN properties.`$referrer` LIKE '%claude.ai%' THEN 'Claude' WHEN properties.`$referrer` LIKE '%perplexity%' THEN 'Perplexity' WHEN properties.`$referrer` LIKE '%gemini%' THEN 'Gemini' ELSE 'Other AI' END as ai_source, count() as visits, uniq(distinct_id) as unique_users FROM events WHERE event = '$pageview' AND ( properties.`$referrer` LIKE '%chatgpt%' OR properties.`$referrer` LIKE '%openai%' OR properties.`$referrer` LIKE '%claude.ai%' OR properties.`$referrer` LIKE '%perplexity%' OR properties.`$referrer` LIKE '%gemini%' ) AND timestamp > now() - INTERVAL 30 DAY GROUP BY ai_source ORDER BY visits DESC '@ } } | ConvertTo-Json -Depth 5
Voir sur GitHub
Ce SKILL.md est tres volumineux, SkillsMP affiche donc ici seulement la premiere section. Voir sur GitHub