Logo vun Installing Posthog In A Codebase

Installing Posthog In A Codebase

Organisatioun
PostHog
installing-posthog-in-a-codebase

Install and configure a PostHog SDK in a repository you can read and edit, following PostHog's docs for the framework. Use when a user working in their codebase asks to add, install, or set up PostHog, product analytics, session replay, or a PostHog SDK. Covers finding the right docs page, installing the latest package, getting the project token and ingestion host from project-get, keeping them in the env file, server-side setup, identifying users, and verifying the change. If you can't access the user's code, as is common in ChatGPT on the web or Claude on the web, use installing-posthog-from-chat instead.

Iwwersiicht

EditeurPostHog
Repositoryskills
Skill-Numminstalling-posthog-in-a-codebase
Stären
77
Forks
8
Matgeliwwert Fichieren
Nëmmen Instruktiounen
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    Vum PostHog op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Installing Posthog In A Codebase an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/PostHog/skills/tree/main/skills/omnibus/installing-posthog-in-a-codebase
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/PostHog/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/omnibus/installing-posthog-in-a-codebase .claude/skills/installing-posthog-in-a-codebase
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Installing Posthog In A Codebase an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Installing Posthog In A Codebase automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Installing Posthog In A Codebase net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Installing PostHog in a codebase

Use this skill when you can read and edit the user's code. If you can't access their code, as is common in ChatGPT on the web or Claude on the web, use installing-posthog-from-chat.

PostHog's docs are the source of truth for each SDK's setup. Init options, file locations and recommended settings change between SDK releases, so read the docs page for the framework before you write code, and follow it rather than what you remember.

1. Find the framework and read its docs

Detect the framework from the manifest files (package.json, pyproject.toml, requirements.txt, Gemfile, composer.json, go.mod, and so on) and the app's entry points. A web app with its own backend usually needs a client SDK and a server SDK, so read both pages.

FrameworkDocs page
JavaScript web (any framework)https://posthog.com/docs/libraries/js.md
React, including Vite appshttps://posthog.com/docs/libraries/react.md
Next.jshttps://posthog.com/docs/libraries/next-js.md
Vue.jshttps://posthog.com/docs/libraries/vue-js.md
Nuxthttps://posthog.com/docs/libraries/nuxt-js.md
Svelte and SvelteKithttps://posthog.com/docs/libraries/svelte.md
Angularhttps://posthog.com/docs/libraries/angular.md
Astrohttps://posthog.com/docs/libraries/astro.md
Remixhttps://posthog.com/docs/libraries/remix.md
React Routerhttps://posthog.com/docs/libraries/react-router.md
TanStack Starthttps://posthog.com/docs/libraries/tanstack-start.md
Node.js, including Expresshttps://posthog.com/docs/libraries/node.md
Python, including FastAPIhttps://posthog.com/docs/libraries/python.md
Djangohttps://posthog.com/docs/libraries/django.md
Flaskhttps://posthog.com/docs/libraries/flask.md
Rubyhttps://posthog.com/docs/libraries/ruby.md
Ruby on Railshttps://posthog.com/docs/libraries/ruby-on-rails.md
PHPhttps://posthog.com/docs/libraries/php.md
Laravelhttps://posthog.com/docs/libraries/laravel.md
Gohttps://posthog.com/docs/libraries/go.md
Javahttps://posthog.com/docs/libraries/java.md
.NEThttps://posthog.com/docs/libraries/dotnet.md
Elixirhttps://posthog.com/docs/libraries/elixir.md
Rusthttps://posthog.com/docs/libraries/rust.md
React Nativehttps://posthog.com/docs/libraries/react-native.md
Flutterhttps://posthog.com/docs/libraries/flutter.md
iOShttps://posthog.com/docs/libraries/ios.md
Androidhttps://posthog.com/docs/libraries/android.md

For a framework that isn't listed, call docs-search with the framework name.

2. Install the latest SDK

Add each package with the project's own package manager and no version, for example npm install posthog-js, pnpm add posthog-node, uv add posthog or bundle add posthog-ruby. That resolves the newest release. Don't type a version into the manifest from memory, because that pins an old release.

In a monorepo, install into the package that runs the app, not the workspace root.

3. Get the token and host

Call project-get without an ID. Use api_token as the project token and api_host as the SDK's host option.

  • Read both from environment variables in code, using the names the docs page uses (for example NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN and NEXT_PUBLIC_POSTHOG_HOST).
  • Write the real values to the env file the framework loads, such as .env.local or .env. If the project has an example env file, add the variable names there with empty values.
  • Never hard-code the token or the host in source files, and never use them as fallback defaults in code.

4. Initialize as the docs show

  • Initialize the SDK once, in the place the docs page names. Don't add a second initialization elsewhere.
  • For posthog-js, set defaults to the date the docs page shows. It selects the newest set of recommended settings, so don't take a date from memory.
  • For a backend SDK in a long-running server, create one client for the process, reuse it, and shut it down when the process exits. Don't create a client per request.
  • In serverless or edge handlers (for example Next.js route handlers on Vercel, or AWS Lambda), the runtime can freeze as soon as the response is sent, so queued events are lost. Flush before the handler returns: await flush() on a reused client, or use the platform's waitUntil, as the docs page describes.
  • For a server-rendered app (Django, Rails, Laravel and similar), add the server SDK as well as the browser snippet.

5. Identify users

If the app has login, call identify after login with a stable user ID from the auth system, such as the database ID, not an email address or display name. Call reset() on logout. Send server-side events with the same distinct ID, so client and server events land on the same person.

6. Verify

Run the project's build, type check or tests, and fix anything your change broke. If you can run the app, load a page and check that events arrive with read-data-schema or execute-sql. Tell the user which environment variables to add in their hosting provider before they deploy.

Heefeg gestallte Froen

Wat mécht de KI-Skill Installing Posthog In A Codebase?

Install and configure a PostHog SDK in a repository you can read and edit, following PostHog's docs for the framework. Use when a user working in their codebase asks to add, install, or set up PostHog, product analytics, session replay, or a PostHog SDK. Covers finding the right docs page, installing the latest package, getting the project token and ingestion host from project-get, keeping them in the env file, server-side setup, identifying users, and verifying the change. If you can't access the user's code, as is common in ChatGPT on the web or Claude on the web, use installing-posthog-f...

Firwat Installing Posthog In A Codebase op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Installing Posthog In A Codebase besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Installing Posthog In A Codebase an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/PostHog/skills/tree/main/skills/omnibus/installing-posthog-in-a-codebase an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Installing Posthog In A Codebase benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Installing Posthog In A Codebase benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Installing Posthog In A Codebase domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Installing Posthog In A Codebase gratis?

Jo. De Skill gëtt vum PostHog ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇