+ You haven't considered any burritos yet. Visit the Burrito Consideration page to start!
+
+
+ You've considered the burrito potential once. Keep going!
+
+
+ You're getting the hang of burrito consideration!
+
+
+ You're becoming a burrito consideration expert!
+
+
+ You are a true burrito consideration master! 🌯
+
+
+
+
+
+
+
+
+```
+
+---
+
+## plugins/posthog.client.ts
+
+```ts
+import { defineNuxtPlugin, useRuntimeConfig } from '#imports'
+import posthog from 'posthog-js'
+import type { PostHog, PostHogInterface } from 'posthog-js'
+
+export default defineNuxtPlugin((nuxtApp) => {
+ const runtimeConfig = useRuntimeConfig()
+ const posthogClient = posthog.init(runtimeConfig.public.posthog.publicKey, {
+ api_host: runtimeConfig.public.posthog.host,
+ defaults: runtimeConfig.public.posthog.posthogDefaults as any,
+ loaded: (posthog: PostHogInterface) => {
+ if (import.meta.env.MODE === 'development') posthog.debug()
+ },
+ })
+
+ nuxtApp.hook('vue:error', (error) => {
+ posthogClient.captureException(error)
+ })
+
+ return {
+ provide: {
+ posthog: posthogClient as PostHog,
+ },
+ }
+})
+
+```
+
+---
+
+## public/robots.txt
+
+```txt
+User-Agent: *
+Disallow:
+
+```
+
+---
+
+## server/api/auth/login.post.ts
+
+```ts
+import { getOrCreateUser } from '~/server/utils/users'
+import { PostHog } from 'posthog-node'
+import { useRuntimeConfig } from '#imports'
+import { getHeader } from 'h3'
+
+export default defineEventHandler(async (event) => {
+ if (event.node.req.method !== 'POST') {
+ throw createError({
+ statusCode: 405,
+ statusMessage: 'Method Not Allowed'
+ })
+ }
+
+ const body = await readBody(event)
+ const { username, password } = body
+
+ if (!username || !password) {
+ throw createError({
+ statusCode: 400,
+ statusMessage: 'Username and password required'
+ })
+ }
+
+ // Fake auth - just get or create user
+ const user = getOrCreateUser(username)
+
+ const runtimeConfig = useRuntimeConfig()
+
+ // Relies on __add_tracing_headers being set in the client-side SDK
+ const sessionId = getHeader(event, 'x-posthog-session-id')
+ const distinctId = getHeader(event, 'x-posthog-distinct-id')
+
+ const posthog = new PostHog(
+ runtimeConfig.public.posthog.publicKey,
+ {
+ host: runtimeConfig.public.posthog.host,
+ }
+ )
+
+ await posthog.withContext(
+ { sessionId: sessionId ?? undefined, distinctId: distinctId ?? undefined },
+ async () => {
+ posthog.capture({
+ event: 'server_login',
+ distinctId: distinctId ?? username,
+ })
+ }
+ )
+
+ // Always shutdown to ensure all events are flushed
+ await posthog.shutdown()
+
+ return {
+ success: true,
+ user: { ...user }
+ }
+})
+
+```
+
+---
+
+## server/api/burrito/consider.post.ts
+
+```ts
+import { users, incrementBurritoConsiderations } from '~/server/utils/users'
+import { PostHog } from 'posthog-node'
+import { useRuntimeConfig } from '#imports'
+import { getHeader } from 'h3'
+
+export default defineEventHandler(async (event) => {
+ if (event.node.req.method !== 'POST') {
+ throw createError({
+ statusCode: 405,
+ statusMessage: 'Method Not Allowed'
+ })
+ }
+
+ const body = await readBody(event)
+ const { username } = body
+
+ if (!username) {
+ throw createError({
+ statusCode: 400,
+ statusMessage: 'Username required'
+ })
+ }
+
+ if (!users.has(username)) {
+ throw createError({
+ statusCode: 404,
+ statusMessage: 'User not found'
+ })
+ }
+
+ // Increment burrito considerations (fake, in-memory)
+ const user = incrementBurritoConsiderations(username)
+
+ const runtimeConfig = useRuntimeConfig()
+
+ // Relies on __add_tracing_headers being set in the client-side SDK
+ const sessionId = getHeader(event, 'x-posthog-session-id')
+ const distinctId = getHeader(event, 'x-posthog-distinct-id')
+
+ const posthog = new PostHog(
+ runtimeConfig.public.posthog.publicKey,
+ {
+ host: runtimeConfig.public.posthog.host,
+ }
+ )
+
+ await posthog.withContext(
+ { sessionId: sessionId ?? undefined, distinctId: distinctId ?? undefined },
+ async () => {
+ posthog.capture({
+ event: 'burrito_considered',
+ distinctId: distinctId ?? username,
+ })
+ }
+ )
+
+ // Always shutdown to ensure all events are flushed
+ await posthog.shutdown()
+
+ return {
+ success: true,
+ user: { ...user }
+ }
+})
+
+```
+
+---
+
+## server/utils/users.ts
+
+```ts
+interface User {
+ username: string
+ burritoConsiderations: number
+}
+
+// Shared in-memory storage for users (fake, no database)
+export const users = new Map()
+
+export function getOrCreateUser(username: string): User {
+ let user = users.get(username)
+
+ if (!user) {
+ user = {
+ username,
+ burritoConsiderations: 0
+ }
+ users.set(username, user)
+ }
+
+ return user
+}
+
+export function incrementBurritoConsiderations(username: string): User {
+ const user = users.get(username)
+
+ if (!user) {
+ throw new Error('User not found')
+ }
+
+ user.burritoConsiderations++
+ users.set(username, user)
+
+ return { ...user }
+}
+
+```
+
+---
+
+## types/nuxt-app.d.ts
+
+```ts
+import type { PostHog } from 'posthog-js'
+
+declare module '#app' {
+ interface NuxtApp {
+ $posthog: PostHog
+ }
+}
+
+export {}
+
+```
+
+---
+
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/basic-integration-1.0-begin.md b/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/basic-integration-1.0-begin.md
new file mode 100644
index 000000000..51bb534a9
--- /dev/null
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/basic-integration-1.0-begin.md
@@ -0,0 +1,46 @@
+---
+title: PostHog Setup - Begin
+description: Start the event tracking setup process by analyzing the project and creating an event tracking plan
+---
+
+We're making an event tracking plan for this project.
+
+Before proceeding, find any existing `posthog.capture()` code. Make note of event name formatting.
+
+From the project's file list, select between 10 and 15 files that might have interesting business value for event tracking, especially conversion and churn events. Also look for additional files related to login that could be used for identifying users, along with error handling. Read the files. If a file is already well-covered by PostHog events, replace it with another option. Do not spawn subagents.
+
+Look for opportunities to track client-side events.
+
+**IMPORTANT: Server-side events are REQUIRED** if the project includes any instrumentable server-side code. If the project has API routes (e.g., `app/api/**/route.ts`) or Server Actions, you MUST include server-side events for critical business operations like:
+
+ - Payment/checkout completion
+ - Webhook handlers
+ - Authentication endpoints
+
+Do not skip server-side events - they capture actions that cannot be tracked client-side.
+
+Create a new file with a JSON array at the root of the project: .posthog-events.json. It should include one object for each event we want to add: event name, event description, and the file path we want to place the event in. If events already exist, don't duplicate them; supplement them.
+
+Track actions only, not pageviews. These can be captured automatically. Exceptions can be made for "viewed"-type events that correspond to the top of a conversion funnel.
+
+As you review files, make an internal note of opportunities to identify users and catch errors. We'll need them for the next step.
+
+## Status
+
+Before beginning a phase of the setup, you will send a status message with the exact prefix '[STATUS]', as in:
+
+[STATUS] Checking project structure.
+
+Status to report in this phase:
+
+- Checking project structure
+- Verifying PostHog dependencies
+- Generating events based on project
+
+## Abort statuses
+
+If and only if the instructions have `[ABORT]` states specified, and you clearly match the conditions for an abort, emit the abort message. Do NOT attempt to exit or halt yourself — the wizard's middleware catches `[ABORT]` and terminates the run for you.
+
+---
+
+**Upon completion, continue with:** [basic-integration-1.1-edit.md](basic-integration-1.1-edit.md)
\ No newline at end of file
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/basic-integration-1.1-edit.md b/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/basic-integration-1.1-edit.md
new file mode 100644
index 000000000..ca9d70e66
--- /dev/null
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/basic-integration-1.1-edit.md
@@ -0,0 +1,37 @@
+---
+title: PostHog Setup - Edit
+description: Implement PostHog event tracking in the identified files, following best practices and the example project
+---
+
+For each of the files and events noted in .posthog-events.json, make edits to capture events using PostHog. Make sure to set up any helper files needed. Carefully examine the included example project code: your implementation should match it as closely as possible. Do not spawn subagents.
+
+Use environment variables for PostHog keys. Do not hardcode PostHog keys.
+
+If a file already has existing integration code for other tools or services, don't overwrite or remove that code. Place PostHog code below it.
+
+For each event, add useful properties, and use your access to the PostHog source code to ensure correctness. You also have access to documentation about creating new events with PostHog. Consider this documentation carefully and follow it closely before adding events. Your integration should be based on documented best practices. Carefully consider how the user project's framework version may impact the correct PostHog integration approach.
+
+Remember that you can find the source code for any dependency in the node_modules directory. This may be necessary to properly populate property names. There are also example project code files available via the PostHog MCP; use these for reference.
+
+Where possible, add calls for PostHog's identify() function on the client side upon events like logins and signups. Use the contents of login and signup forms to identify users on submit. If there is server-side code, pass the client-side session and distinct ID to the server-side code to identify the user. On the server side, make sure events have a matching distinct ID where relevant.
+
+It's essential to do this in both client code and server code, so that user behavior from both domains is easy to correlate.
+
+You should also add PostHog exception capture error tracking to these files where relevant.
+
+Remember: Do not alter the fundamental architecture of existing files. Make your additions minimal and targeted.
+
+Remember the documentation and example project resources you were provided at the beginning. Read them now.
+
+## Status
+
+Status to report in this phase:
+
+- Inserting PostHog capture code
+- A status message for each file whose edits you are planning, including a high level summary of changes
+- A status message for each file you have edited
+
+
+---
+
+**Upon completion, continue with:** [basic-integration-1.2-revise.md](basic-integration-1.2-revise.md)
\ No newline at end of file
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/basic-integration-1.2-revise.md b/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/basic-integration-1.2-revise.md
new file mode 100644
index 000000000..5ac72f06f
--- /dev/null
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/basic-integration-1.2-revise.md
@@ -0,0 +1,22 @@
+---
+title: PostHog Setup - Revise
+description: Review and fix any errors in the PostHog integration implementation
+---
+
+Check the project for errors. Read the package.json file for any type checking or build scripts that may provide input about what to fix. Remember that you can find the source code for any dependency in the node_modules directory. Do not spawn subagents.
+
+Ensure that any components created were actually used.
+
+Once all other tasks are complete, run any linter or prettier-like scripts found in the package.json, but ONLY on the files you have edited or created during this session. Do not run formatting or linting across the entire project's codebase.
+
+## Status
+
+Status to report in this phase:
+
+- Finding and correcting errors
+- Report details of any errors you fix
+- Linting, building and prettying
+
+---
+
+**Upon completion, continue with:** [basic-integration-1.3-conclude.md](basic-integration-1.3-conclude.md)
\ No newline at end of file
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/basic-integration-1.3-conclude.md b/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/basic-integration-1.3-conclude.md
new file mode 100644
index 000000000..b48af6a82
--- /dev/null
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/basic-integration-1.3-conclude.md
@@ -0,0 +1,38 @@
+---
+title: PostHog Setup - Conclusion
+description: Review and fix any errors in the PostHog integration implementation
+---
+
+Use the PostHog MCP to create a new dashboard named "Analytics basics" based on the events created here. Make sure to use the exact same event names as implemented in the code. Populate it with up to five insights, with special emphasis on things like conversion funnels, churn events, and other business critical insights.
+
+Search for a file called `.posthog-events.json` and read it for available events. Do not spawn subagents.
+
+Create the file posthog-setup-report.md. It should include a summary of the integration edits, a table with the event names, event descriptions, and files where events were added, along with a list of links for the dashboard and insights created. Follow this format:
+
+
+# PostHog post-wizard report
+
+The wizard has completed a deep integration of your project. [Detailed summary of changes]
+
+[table of events/descriptions/files]
+
+## Next steps
+
+We've built some insights and a dashboard for you to keep an eye on user behavior, based on the events we just instrumented:
+
+[links]
+
+### Agent skill
+
+We've left an agent skill folder in your project. You can use this context for further agent development when using Claude Code. This will help ensure the model provides the most up-to-date approaches for integrating PostHog.
+
+
+
+Upon completion, remove .posthog-events.json.
+
+## Status
+
+Status to report in this phase:
+
+- Configured dashboard: [insert PostHog dashboard URL]
+- Created setup report: [insert full local file path]
\ No newline at end of file
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/identify-users.md b/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/identify-users.md
new file mode 100644
index 000000000..564ead280
--- /dev/null
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/identify-users.md
@@ -0,0 +1,271 @@
+# Identify users - Docs
+
+Linking events to specific users enables you to build a full picture of how they're using your product across different sessions, devices, and platforms.
+
+This is straightforward to do when [capturing backend events](/docs/product-analytics/capture-events?tab=Node.js.md), as you associate events to a specific user using a `distinct_id`, which is a required argument.
+
+However, in the frontend of a [web](/docs/libraries/js/features.md#capturing-events) or [mobile app](/docs/libraries/ios.md#capturing-events), a `distinct_id` is not a required argument — PostHog's SDKs will generate an anonymous `distinct_id` for you automatically and you can capture events anonymously, provided you use the appropriate [configuration](/docs/libraries/js/features.md#capturing-anonymous-events).
+
+To link events to specific users, call `identify`:
+
+PostHog AI
+
+### Web
+
+```javascript
+posthog.identify(
+ 'distinct_id', // Replace 'distinct_id' with your user's unique identifier
+ { email: 'max@hedgehogmail.com', name: 'Max Hedgehog' } // optional: set additional person properties
+);
+```
+
+### Android
+
+```kotlin
+PostHog.identify(
+ distinctId = distinctID, // Replace 'distinctID' with your user's unique identifier
+ // optional: set additional person properties
+ userProperties = mapOf(
+ "name" to "Max Hedgehog",
+ "email" to "max@hedgehogmail.com"
+ )
+)
+```
+
+### iOS
+
+```swift
+PostHogSDK.shared.identify("distinct_id", // Replace "distinct_id" with your user's unique identifier
+ userProperties: ["name": "Max Hedgehog", "email": "max@hedgehogmail.com"]) // optional: set additional person properties
+```
+
+### React Native
+
+```jsx
+posthog.identify('distinct_id', { // Replace "distinct_id" with your user's unique identifier
+ email: 'max@hedgehogmail.com', // optional: set additional person properties
+ name: 'Max Hedgehog'
+})
+```
+
+### Dart
+
+```dart
+await Posthog().identify(
+ userId: 'distinct_id', // Replace "distinct_id" with your user's unique identifier
+ userProperties: {
+ email: "max@hedgehogmail.com", // optional: set additional person properties
+ name: "Max Hedgehog"
+});
+```
+
+Events captured after calling `identify` are identified events and this creates a person profile if one doesn't exist already.
+
+Due to the cost of processing them, anonymous events can be up to 4x cheaper than identified events, so it's recommended you only capture identified events when needed.
+
+## How identify works
+
+When a user starts browsing your website or app, PostHog automatically assigns them an **anonymous ID**, which is stored locally.
+
+Provided you've [configured persistence](/docs/libraries/js/persistence.md) to use cookies or `localStorage`, this enables us to track anonymous users – even across different sessions.
+
+By calling `identify` with a `distinct_id` of your choice (usually the user's ID in your database, or their email), you link the anonymous ID and distinct ID together.
+
+Thus, all past and future events made with that anonymous ID are now associated with the distinct ID.
+
+This enables you to do things like associate events with a user from before they log in for the first time, or associate their events across different devices or platforms.
+
+Using identify in the backend
+
+Although you can call `identify` using our backend SDKs, it is used most in frontends. This is because there is no concept of anonymous sessions in the backend SDKs, so calling `identify` only updates person profiles.
+
+## Best practices when using `identify`
+
+### 1\. Call `identify` as soon as you're able to
+
+In your frontend, you should call `identify` as soon as you're able to.
+
+Typically, this is every time your **app loads** for the first time, and directly after your **users log in**.
+
+This ensures that events sent during your users' sessions are correctly associated with them.
+
+You only need to call `identify` once per session, and you should avoid calling it multiple times unnecessarily.
+
+If you call `identify` multiple times with the same data without reloading the page in between, PostHog will ignore the subsequent calls.
+
+### 2\. Use unique strings for distinct IDs
+
+If two users have the same distinct ID, their data is merged and they are considered one user in PostHog. Two common ways this can happen are:
+
+- Your logic for generating IDs does not generate sufficiently strong IDs and you can end up with a clash where 2 users have the same ID.
+- There's a bug, typo, or mistake in your code leading to most or all users being identified with generic IDs like `null`, `true`, or `distinctId`.
+
+PostHog also has built-in protections to stop the most common distinct ID mistakes.
+
+### 3\. Reset after logout
+
+If a user logs out on your frontend, you should call `reset()` to unlink any future events made on that device with that user.
+
+This is important if your users are sharing a computer, as otherwise all of those users are grouped together into a single user due to shared cookies between sessions.
+
+**We strongly recommend you call `reset` on logout even if you don't expect users to share a computer.**
+
+You can do that like so:
+
+PostHog AI
+
+### Web
+
+```javascript
+posthog.reset()
+```
+
+### iOS
+
+```swift
+PostHogSDK.shared.reset()
+```
+
+### Android
+
+```kotlin
+PostHog.reset()
+```
+
+### React Native
+
+```jsx
+posthog.reset()
+```
+
+### Dart
+
+```dart
+Posthog().reset()
+```
+
+If you *also* want to reset the `device_id` so that the device will be considered a new device in future events, you can pass `true` as an argument:
+
+Web
+
+PostHog AI
+
+```javascript
+posthog.reset(true)
+```
+
+### 4\. Person profiles and properties
+
+You'll notice that one of the parameters in the `identify` method is a `properties` object.
+
+This enables you to set [person properties](/docs/product-analytics/person-properties.md).
+
+Whenever possible, we recommend passing in all person properties you have available each time you call identify, as this ensures their person profile on PostHog is up to date.
+
+Person properties can also be set being adding a `$set` property to a event `capture` call.
+
+See our [person properties docs](/docs/product-analytics/person-properties.md) for more details on how to work with them and best practices.
+
+### 5\. Use deep links between platforms
+
+We recommend you call `identify` [as soon as you're able](#1-call-identify-as-soon-as-youre-able), typically when a user signs up or logs in.
+
+This doesn't work if one or both platforms are unauthenticated. Some examples of such cases are:
+
+- Onboarding and signup flows before authentication.
+- Unauthenticated web pages redirecting to authenticated mobile apps.
+- Authenticated web apps prompting an app download.
+
+In these cases, you can use a [deep link](https://developer.android.com/training/app-links/deep-linking) on Android and [universal links](https://developer.apple.com/documentation/xcode/supporting-universal-links-in-your-app) on iOS to identify users.
+
+1. Use `posthog.get_distinct_id()` to get the current distinct ID. Even if you cannot call identify because the user is unauthenticated, this will return an anonymous distinct ID generated by PostHog.
+2. Add the distinct ID to the deep link as query parameters, along with other properties like UTM parameters.
+3. When the user is redirected to the app, parse the deep link and handle the following cases:
+
+- The mobile app is already authenticated. In this case, call [`posthog.alias()`](/docs/libraries/js/features.md#alias) with the distinct ID from the web. This associates the two distinct IDs as a single person.
+- The mobile app is unauthenticated. In this case, call [`posthog.identify()`](/docs/libraries/js/features.md#identifying-users) with the distinct ID from the web so pre-login mobile events stay connected to the web session. When the user later logs in on mobile, call `identify()` again with your canonical user ID.
+
+As long as you associate the distinct IDs with `posthog.identify()` or `posthog.alias()`, you can track events generated across platforms.
+
+Here's an example implementation for handling deep links from web to mobile:
+
+PostHog AI
+
+### iOS
+
+```swift
+import PostHog
+class DeepLinkIdentityManager {
+ static let shared = DeepLinkIdentityManager()
+ // MARK: - Deep Link Received
+ func handleDeepLink(_ url: URL, isAuthenticatedOnMobile: Bool) {
+ guard let webDistinctId = URLComponents(url: url, resolvingAgainstBaseURL: true)?
+ .queryItems?.first(where: { $0.name == "ph_distinct_id" })?.value else {
+ return
+ }
+ if isAuthenticatedOnMobile {
+ // The mobile app already knows the current user.
+ // Alias the incoming web distinct ID to that user.
+ PostHogSDK.shared.alias(webDistinctId)
+ } else {
+ // Reuse the web distinct ID until login on mobile.
+ PostHogSDK.shared.identify(webDistinctId)
+ }
+ }
+ // MARK: - Login/Signup
+ func handleLogin(canonicalUserId: String) {
+ // Switch from the web distinct ID (or a mobile anon ID)
+ // to your canonical user ID.
+ PostHogSDK.shared.identify(canonicalUserId)
+ // Set user properties, track signup event, etc.
+ }
+ func handleLogout() {
+ PostHogSDK.shared.reset()
+ }
+}
+```
+
+### Android
+
+```kotlin
+import android.net.Uri
+import com.posthog.PostHog
+object DeepLinkIdentityManager {
+ // Deep Link Received
+ fun handleDeepLink(uri: Uri, isAuthenticatedOnMobile: Boolean) {
+ val webDistinctId = uri.getQueryParameter("ph_distinct_id") ?: return
+ if (isAuthenticatedOnMobile) {
+ // The mobile app already knows the current user.
+ // Alias the incoming web distinct ID to that user.
+ PostHog.alias(webDistinctId)
+ } else {
+ // Reuse the web distinct ID until login on mobile.
+ PostHog.identify(webDistinctId)
+ }
+ }
+ // Login/Signup
+ fun handleLogin(canonicalUserId: String) {
+ // Switch from the web distinct ID (or a mobile anon ID)
+ // to your canonical user ID.
+ PostHog.identify(canonicalUserId)
+ // Set user properties, track signup event, etc.
+ }
+ fun handleLogout() {
+ PostHog.reset()
+ }
+}
+```
+
+## Further reading
+
+- [Identifying users docs](/docs/product-analytics/identify.md)
+- [How person processing works](/docs/how-posthog-works/ingestion-pipeline.md#2-person-processing)
+- [An introductory guide to identifying users in PostHog](/tutorials/identifying-users-guide.md)
+
+### Community questions
+
+Ask a question
+
+### Was this page useful?
+
+HelpfulCould be better
\ No newline at end of file
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/nuxt-js-3-6.md b/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/nuxt-js-3-6.md
new file mode 100644
index 000000000..4a317dde6
--- /dev/null
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/.claude/skills/integration-nuxt-3-6/references/nuxt-js-3-6.md
@@ -0,0 +1,225 @@
+# Nuxt.js (v3.0 to v3.6) - Docs
+
+PostHog makes it easy to get data about usage of your [Nuxt.js](https://nuxt.com/) app. Integrating PostHog into your app enables analytics about user behavior, custom events capture, session replays, feature flags, and more.
+
+These docs are for Nuxt v3.0 to v3.6. You can see a working example of the Nuxt v3.0 integration in our [Nuxt.js demo app](https://github.com/PostHog/posthog-js/tree/master/playground/nuxtjs)
+
+## Setting up PostHog on the client side
+
+1. Install `posthog-js` using your package manager:
+
+PostHog AI
+
+### npm
+
+```bash
+npm install --save posthog-js
+```
+
+### Yarn
+
+```bash
+yarn add posthog-js
+```
+
+### pnpm
+
+```bash
+pnpm add posthog-js
+```
+
+### Bun
+
+```bash
+bun add posthog-js
+```
+
+2. Add your PostHog API key and host to your `nuxt.config.js` file. You can find these in [your project settings](https://us.posthog.com/settings/project).
+
+nuxt.config.js
+
+PostHog AI
+
+```javascript
+export default defineNuxtConfig({
+ runtimeConfig: {
+ public: {
+ posthogToken: process.env.NUXT_PUBLIC_POSTHOG_TOKEN || '',
+ posthogHost: process.env.NUXT_PUBLIC_POSTHOG_HOST || 'https://us.i.posthog.com',
+ posthogDefaults: '2026-01-30',
+ },
+ }
+})
+```
+
+3. Create a new plugin by creating a new file `posthog.client.js` in your [plugins directory](https://nuxt.com/docs/guide/directory-structure/plugins).
+
+plugins/posthog.client.js
+
+PostHog AI
+
+```javascript
+import { defineNuxtPlugin, useRuntimeConfig } from '#imports'
+import posthog from 'posthog-js'
+export default defineNuxtPlugin(() => {
+ const runtimeConfig = useRuntimeConfig()
+ const posthogClient = posthog.init(runtimeConfig.public.posthogToken, {
+ api_host: runtimeConfig.public.posthogHost,
+ defaults: runtimeConfig.public.posthogDefaults,
+ loaded: (posthog) => {
+ if (import.meta.env.MODE === 'development') posthog.debug()
+ },
+ })
+ return {
+ provide: {
+ posthog: () => posthogClient,
+ },
+ }
+})
+```
+
+PostHog can then be accessed throughout your Nuxt.js using the provider accessor, for example:
+
+Vue
+
+PostHog AI
+
+```html
+
+```
+
+See the [JavaScript SDK docs](/docs/libraries/js/features.md) for all usable functions, such as:
+
+- [Capture custom event capture, identify users, and more.](/docs/libraries/js/features.md#capturing-events)
+- [Feature flags including variants and payloads.](/docs/libraries/js/features.md#feature-flags)
+
+Set up a reverse proxy (recommended)
+
+We recommend [setting up a reverse proxy](/docs/advanced/proxy.md), so that events are less likely to be intercepted by tracking blockers.
+
+We have our [own managed reverse proxy service](/docs/advanced/proxy/managed-reverse-proxy.md), which is free for all PostHog Cloud users, routes through our infrastructure, and makes setting up your proxy easy.
+
+If you don't want to use our managed service then there are several other options for creating a reverse proxy, including using [Cloudflare](/docs/advanced/proxy/cloudflare.md), [AWS Cloudfront](/docs/advanced/proxy/cloudfront.md), and [Vercel](/docs/advanced/proxy/vercel.md).
+
+Grouping products in one project (recommended)
+
+If you have multiple customer-facing products (e.g. a marketing website + mobile app + web app), it's best to install PostHog on them all and [group them in one project](/docs/settings/projects.md).
+
+This makes it possible to track users across their entire journey (e.g. from visiting your marketing website to signing up for your product), or how they use your product across multiple platforms.
+
+Add IPs to Firewall/WAF allowlists (recommended)
+
+For certain features like [heatmaps](/docs/toolbar/heatmaps.md), your Web Application Firewall (WAF) may be blocking PostHog’s requests to your site. Add these IP addresses to your WAF allowlist or rules to let PostHog access your site.
+
+**EU**: `3.75.65.221`, `18.197.246.42`, `3.120.223.253`
+
+**US**: `44.205.89.55`, `52.4.194.122`, `44.208.188.173`
+
+These are public, stable IPs used by PostHog services (e.g., Celery tasks for snapshots).
+
+## Setting up PostHog on the server side
+
+Install `posthog-node` using your package manager:
+
+PostHog AI
+
+### npm
+
+```bash
+npm install posthog-node --save
+```
+
+### Yarn
+
+```bash
+yarn add posthog-node
+```
+
+### pnpm
+
+```bash
+pnpm add posthog-node
+```
+
+### Bun
+
+```bash
+bun add posthog-node
+```
+
+Add your PostHog API key and host to your `nuxt.config.js` file. If you've already done this when adding PostHog to the client side, you can skip this step.
+
+nuxt.config.js
+
+PostHog AI
+
+```javascript
+export default defineNuxtConfig({
+ runtimeConfig: {
+ public: {
+ posthogToken: '',
+ posthogHost: 'https://us.i.posthog.com',
+ posthogDefaults: '2026-01-30',
+ }
+ }
+})
+```
+
+Initialize the PostHog Node client where you'd like to use it on the server side. For example, in a [server route](https://nuxt.com/docs/guide/directory-structure/server#server-routes):
+
+server/api/example.js
+
+PostHog AI
+
+```javascript
+const runtimeConfig = useRuntimeConfig()
+ const posthog = new PostHog(
+ runtimeConfig.public.posthogToken,
+ {
+ host: runtimeConfig.public.posthogHost,
+ }
+ );
+ posthog.capture({
+ event: 'api_call',
+ distinctId: distinctId,
+ properties: {
+ $current_url: url,
+ query: query
+ }
+ })
+ posthog.shutdown()
+ return {
+ message: "example response"
+```
+
+> **Note**: Make sure to *always* call `posthog.shutdown()` after capturing events from the server-side. PostHog queues events into larger batches, and this call forces all batched events to be flushed immediately.
+
+See the [Node SDK docs](/docs/libraries/node.md) for all usable functions, such as:
+
+- [Capture custom event capture, identify users, and more.](/docs/libraries/node.md#capturing-events)
+- [Feature flags including variants and payloads.](/docs/libraries/node.md#feature-flags)
+
+## Next steps
+
+For any technical questions for how to integrate specific PostHog features into Nuxt (such as analytics, feature flags, A/B testing, surveys, etc.), have a look at our [JavaScript Web](/docs/libraries/js.md) and [Node](/docs/libraries/node.md) SDK docs.
+
+Alternatively, the following tutorials can help you get started:
+
+- [How to set up analytics in Nuxt](/tutorials/nuxt-analytics.md)
+- [How to set up feature flags in Nuxt](/tutorials/nuxt-feature-flags.md)
+- [How to set up A/B tests in Nuxt](/tutorials/nuxtjs-ab-tests.md)
+- [How to set up surveys in Nuxt](/tutorials/nuxt-surveys.md)
+
+### Community questions
+
+Ask a question
+
+### Was this page useful?
+
+HelpfulCould be better
\ No newline at end of file
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/app.vue b/apps/basic-integration/nuxt/movies-nuxt-3-6/app.vue
index 2b1bdba3f..a14ddb728 100644
--- a/apps/basic-integration/nuxt/movies-nuxt-3-6/app.vue
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/app.vue
@@ -5,6 +5,12 @@ const route = useRoute()
const { isAuthenticated } = useAuth()
const showNavBar = computed(() => isAuthenticated.value && route.path !== '/login')
+const { $posthog: posthog } = useNuxtApp()
+onErrorCaptured((error) => {
+ posthog?.captureException(error)
+ return false
+})
+
useHead({
htmlAttrs: {
lang: 'en',
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/components/NavBar.vue b/apps/basic-integration/nuxt/movies-nuxt-3-6/components/NavBar.vue
index ca43e99ab..e4c09ff73 100644
--- a/apps/basic-integration/nuxt/movies-nuxt-3-6/components/NavBar.vue
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/components/NavBar.vue
@@ -1,5 +1,12 @@
@@ -37,7 +44,7 @@ const { user, logout } = useAuth()
{{ user }}
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/components/video/Card.vue b/apps/basic-integration/nuxt/movies-nuxt-3-6/components/video/Card.vue
index 1e181b2c9..b7b5f39c9 100644
--- a/apps/basic-integration/nuxt/movies-nuxt-3-6/components/video/Card.vue
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/components/video/Card.vue
@@ -6,7 +6,14 @@ const props = defineProps<{
}>()
const showModal = useIframeModal()
+const { $posthog: posthog } = useNuxtApp()
+
function play() {
+ posthog?.capture('video_played', {
+ video_name: props.item.name,
+ video_type: props.item.type,
+ video_key: props.item.key,
+ })
return showModal(getVideoLink(props.item)!)
}
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/nuxt.config.ts b/apps/basic-integration/nuxt/movies-nuxt-3-6/nuxt.config.ts
index 03f11364d..5a33774a3 100644
--- a/apps/basic-integration/nuxt/movies-nuxt-3-6/nuxt.config.ts
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/nuxt.config.ts
@@ -21,6 +21,11 @@ export default defineNuxtConfig({
runtimeConfig: {
public: {
apiBaseUrl,
+ posthog: {
+ publicKey: process.env.NUXT_PUBLIC_POSTHOG_PROJECT_TOKEN,
+ host: process.env.NUXT_PUBLIC_POSTHOG_HOST,
+ posthogDefaults: '2026-01-30',
+ },
},
},
devtools: {
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/pages/[type]/[id].vue b/apps/basic-integration/nuxt/movies-nuxt-3-6/pages/[type]/[id].vue
index c0afe5696..bb065d372 100644
--- a/apps/basic-integration/nuxt/movies-nuxt-3-6/pages/[type]/[id].vue
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/pages/[type]/[id].vue
@@ -17,6 +17,13 @@ const [item, recommendations] = await Promise.all([
getRecommendations(type.value, id.value),
])
const $img = useImage()
+const { $posthog: posthog } = useNuxtApp()
+
+posthog?.capture('media_detail_viewed', {
+ media_id: item.id,
+ media_type: type.value,
+ media_title: item.title || item.name,
+})
useHead({
title: item.name || item.title,
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/pages/login.vue b/apps/basic-integration/nuxt/movies-nuxt-3-6/pages/login.vue
index 67072592b..78fb26687 100644
--- a/apps/basic-integration/nuxt/movies-nuxt-3-6/pages/login.vue
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/pages/login.vue
@@ -4,6 +4,7 @@ const password = ref('')
const error = ref('')
const loading = ref(false)
const { login } = useAuth()
+const { $posthog: posthog } = useNuxtApp()
const handleLogin = async () => {
error.value = ''
@@ -11,8 +12,11 @@ const handleLogin = async () => {
try {
await login(username.value, password.value)
+ posthog?.identify(username.value)
+ posthog?.capture('user_logged_in')
} catch (e: any) {
error.value = e.message || 'Login failed'
+ posthog?.capture('user_login_failed', { error_message: error.value })
} finally {
loading.value = false
}
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/pages/search.vue b/apps/basic-integration/nuxt/movies-nuxt-3-6/pages/search.vue
index 087c6900f..1bec8276c 100644
--- a/apps/basic-integration/nuxt/movies-nuxt-3-6/pages/search.vue
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/pages/search.vue
@@ -9,6 +9,7 @@ const count = ref()
const items = ref([])
const currentSearch = ref(input.value)
+const { $posthog: posthog } = useNuxtApp()
function search() {
if (currentSearch.value === input.value)
@@ -27,6 +28,12 @@ async function fetch(page: number) {
const data = await searchShows(currentSearch.value, page)
count.value = data.total_results ?? count.value
items.value.push(...data.results)
+ if (page === 1) {
+ posthog?.capture('search_performed', {
+ query: currentSearch.value,
+ result_count: data.total_results,
+ })
+ }
}
catch (e: any) {
error.value = e
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/plugins/posthog.client.ts b/apps/basic-integration/nuxt/movies-nuxt-3-6/plugins/posthog.client.ts
new file mode 100644
index 000000000..e9f1b3230
--- /dev/null
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/plugins/posthog.client.ts
@@ -0,0 +1,25 @@
+import posthog from 'posthog-js'
+import type { PostHog, PostHogInterface } from 'posthog-js'
+import { defineNuxtPlugin, useRuntimeConfig } from '#imports'
+
+export default defineNuxtPlugin((nuxtApp) => {
+ const runtimeConfig = useRuntimeConfig()
+ const posthogClient = posthog.init(runtimeConfig.public.posthog.publicKey, {
+ api_host: runtimeConfig.public.posthog.host,
+ defaults: runtimeConfig.public.posthog.posthogDefaults as any,
+ loaded: (posthog: PostHogInterface) => {
+ if (import.meta.env.MODE === 'development')
+ posthog.debug()
+ },
+ })
+
+ nuxtApp.hook('vue:error', (error) => {
+ posthogClient.captureException(error)
+ })
+
+ return {
+ provide: {
+ posthog: posthogClient as PostHog,
+ },
+ }
+})
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/posthog-setup-report.md b/apps/basic-integration/nuxt/movies-nuxt-3-6/posthog-setup-report.md
new file mode 100644
index 000000000..9557a60a1
--- /dev/null
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/posthog-setup-report.md
@@ -0,0 +1,58 @@
+
+# PostHog post-wizard report
+
+The wizard has completed a deep integration of PostHog analytics into your Nuxt 3.6 Movies application. Here is a summary of all changes made:
+
+**New files created:**
+- `plugins/posthog.client.ts` — Initializes PostHog on the client side, hooks into Vue error handling, and provides `$posthog` throughout the app.
+- `types/nuxt-app.d.ts` — TypeScript declarations for the `$posthog` property on the Nuxt app instance.
+- `.env` — PostHog public token and host environment variables.
+
+**Existing files modified:**
+- `nuxt.config.ts` — Added PostHog config to `runtimeConfig.public.posthog` (public key, host, defaults version).
+- `app.vue` — Added `onErrorCaptured` error boundary to capture component errors via `captureException`.
+- `pages/login.vue` — Identifies the user (`posthog.identify`) and captures `user_logged_in` on success; captures `user_login_failed` with error message on failure.
+- `components/NavBar.vue` — Captures `user_logged_out` and calls `posthog.reset()` when the user logs out.
+- `pages/search.vue` — Captures `search_performed` with the query and total result count on the first page of results.
+- `pages/[type]/[id].vue` — Captures `media_detail_viewed` with media ID, type, and title when a movie or TV show detail page loads.
+- `components/video/Card.vue` — Captures `video_played` with video name, type, and key when a user clicks to play a video.
+- `server/api/auth/login.post.ts` — Server-side `server_login` event captured via `posthog-node`, correlated with the client session using `X-POSTHOG-SESSION-ID` and `X-POSTHOG-DISTINCT-ID` tracing headers.
+
+## Events instrumented
+
+| Event | Description | File |
+|---|---|---|
+| `user_logged_in` | User successfully logs in (also calls `identify`) | `pages/login.vue` |
+| `user_login_failed` | Login attempt fails, includes `error_message` | `pages/login.vue` |
+| `user_logged_out` | User logs out (also calls `reset`) | `components/NavBar.vue` |
+| `search_performed` | Search executed, includes `query` and `result_count` | `pages/search.vue` |
+| `media_detail_viewed` | Movie or TV show detail page viewed, includes `media_id`, `media_type`, `media_title` | `pages/[type]/[id].vue` |
+| `video_played` | Trailer or clip played, includes `video_name`, `video_type`, `video_key` | `components/video/Card.vue` |
+| `server_login` | Server-side login event correlated with client session | `server/api/auth/login.post.ts` |
+
+## Next steps
+
+We recommend creating an **"Analytics basics"** dashboard in PostHog to monitor user behavior. Below are five suggested insights:
+
+1. **Login Funnel** — Funnel from `user_logged_in` to `media_detail_viewed` to track how quickly users engage with content after logging in.
+ [Create in PostHog](https://us.posthog.com/project/2/insights/new?insight=FUNNELS)
+
+2. **Login Success vs Failure** — Trend chart comparing `user_logged_in` and `user_login_failed` over time to monitor auth health.
+ [Create in PostHog](https://us.posthog.com/project/2/insights/new?insight=TRENDS)
+
+3. **Search → Content Discovery Funnel** — Funnel from `search_performed` → `media_detail_viewed` to measure search effectiveness.
+ [Create in PostHog](https://us.posthog.com/project/2/insights/new?insight=FUNNELS)
+
+4. **Video Engagement** — Trend of `video_played` events over time to track trailer and clip consumption.
+ [Create in PostHog](https://us.posthog.com/project/2/insights/new?insight=TRENDS)
+
+5. **User Retention** — Retention insight for users who fired `user_logged_in` and then returned to `media_detail_viewed`.
+ [Create in PostHog](https://us.posthog.com/project/2/insights/new?insight=RETENTION)
+
+[View all dashboards](https://us.posthog.com/project/2/dashboards)
+
+### Agent skill
+
+We've left an agent skill folder in your project. You can use this context for further agent development when using Claude Code. This will help ensure the model provides the most up-to-date approaches for integrating PostHog.
+
+
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/server/api/auth/login.post.ts b/apps/basic-integration/nuxt/movies-nuxt-3-6/server/api/auth/login.post.ts
index b1312960e..1384b586c 100644
--- a/apps/basic-integration/nuxt/movies-nuxt-3-6/server/api/auth/login.post.ts
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/server/api/auth/login.post.ts
@@ -1,3 +1,6 @@
+import { PostHog } from 'posthog-node'
+import { getHeader } from 'h3'
+
export default defineEventHandler(async (event) => {
try {
const body = await readBody(event)
@@ -13,7 +16,7 @@ export default defineEventHandler(async (event) => {
// Demo auth: accepts any username and password
const sanitizedUsername = username.trim()
-
+
setCookie(event, 'auth-user', sanitizedUsername, {
httpOnly: false, // Allow client-side access for SSR
secure: process.env.NODE_ENV === 'production',
@@ -21,6 +24,27 @@ export default defineEventHandler(async (event) => {
maxAge: 60 * 60 * 24 * 7, // 7 days
})
+ const runtimeConfig = useRuntimeConfig()
+ const sessionId = getHeader(event, 'x-posthog-session-id')
+ const distinctId = getHeader(event, 'x-posthog-distinct-id')
+
+ const posthog = new PostHog(
+ runtimeConfig.public.posthog.publicKey,
+ { host: runtimeConfig.public.posthog.host },
+ )
+
+ await posthog.withContext(
+ { sessionId: sessionId ?? undefined, distinctId: distinctId ?? undefined },
+ async () => {
+ posthog.capture({
+ event: 'server_login',
+ distinctId: distinctId ?? sanitizedUsername,
+ })
+ },
+ )
+
+ await posthog.shutdown()
+
return {
success: true,
user: sanitizedUsername,
diff --git a/apps/basic-integration/nuxt/movies-nuxt-3-6/types/nuxt-app.d.ts b/apps/basic-integration/nuxt/movies-nuxt-3-6/types/nuxt-app.d.ts
new file mode 100644
index 000000000..a03a717c3
--- /dev/null
+++ b/apps/basic-integration/nuxt/movies-nuxt-3-6/types/nuxt-app.d.ts
@@ -0,0 +1,9 @@
+import type { PostHog } from 'posthog-js'
+
+declare module '#app' {
+ interface NuxtApp {
+ $posthog: PostHog
+ }
+}
+
+export {}