@@ -155,8 +155,39 @@ export default MyComponent = function () {
155155
156156#### Server Component
157157
158- Currently, tracking events in server components is not supported due to limitations in Next.js.
159- Please trigger any event tracking from client components.
158+ ::: note
159+ Event tracking in server components requires Next.js SDK version >= 3.0.0 and Next.js >= 15.1.0.
160+ :::
161+
162+ ``` typescript tsx
163+ import * as React from ' react'
164+ import { MyComponent } from ' ./components'
165+ import { track } from ' ./devcycle'
166+
167+ export const MyServerComponent = async function () {
168+ await track ({ type: ' myEvent' })
169+ return <MyComponent />
170+ }
171+ ```
172+
173+ :::caution
174+ If you are not hosting your Next.js application on Vercel,
175+ you might see runtime errors if `waitUntil` is not supported by the platform and will be
176+ required to set `disableCustomEventLogging` and `disableAutomaticEventLogging` options to `true`:
177+
178+ ```typescript
179+ export const { getVariableValue, getClientContext } = setupDevCycle({
180+ serverSDKKey: process .env .DEVCYCLE_SERVER_SDK_KEY ?? ' ' ,
181+ clientSDKKey: process .env .NEXT_PUBLIC_DEVCYCLE_CLIENT_SDK_KEY ?? ' ' ,
182+ userGetter: getUserIdentity ,
183+ options: {
184+ disableAutomaticEventLogging: true ,
185+ disableCustomEventLogging: true ,
186+ },
187+ })
188+ ` ` `
189+ See [Next.js docs](https://nextjs.org/docs/app/api-reference/functions/after) and your provider's docs for more info.
190+ :::
160191
161192### Getting all Variables
162193
0 commit comments