fix /demo 404, update docs

This commit is contained in:
Johannes
2023-03-31 12:02:11 +02:00
parent 40fb28f5e1
commit 5968d764ca
4 changed files with 18 additions and 5 deletions

View File

@@ -67,7 +67,7 @@ const nextConfig = {
},
{
source: "/demo",
destination: "https://app.formbricks.com/demo",
destination: "https://app.formbricks.com/",
permanent: false,
},
{

View File

@@ -31,17 +31,20 @@ pnpm add @formbricks/js
## Integrating Formbricks SDK with Next.js
Update your App component in the \_app.ts file.
Update your App component in the \_app.ts file like so:
```tsx
import "@/styles/globals.css";
import type { AppProps } from "next/app";
import { useEffect } from "react";
import { useRouter } from "next/router";
import formbricks from "@formbricks/js";
if (typeof window !== "undefined") {
formbricks.init({
environmentId: "your-environment-id",
apiHost: "your-api-host", // e.g. https://app.formbricks.com
logLevel: "debug", // remove when in production
});
}
@@ -62,8 +65,17 @@ export default function App({ Component, pageProps }: AppProps) {
}
```
First you need to initialize the Formbricks SDK, making sure it only runs on the client side. To connect the Next.js router to Formbricks and ensure the SDK can keep track of every page change, you need to register the route change event.
**What are we doing here?**
First we need to initialize the Formbricks SDK, making sure it only runs on the client side.
That's it! 🎉 You have now successfully integrated the Formbricks SDK into your Next.js application. You can start creating and customizing in-product micro-surveys to gather valuable feedback from your users and improve your product experience.
To connect the Next.js router to Formbricks and ensure the SDK can keep track of every page change, we are registering the route change event.
That's it! 🎉
You should now see that the Widget Status in the setup checklist updated accordingly:
If it doesnt work, please [join our Discord](https://formbricks.com/discord) and let us know!
You have now successfully integrated the Formbricks SDK into your Next.js application. You can start creating and customizing in-product micro-surveys to gather valuable feedback from your users and improve your product experience.
export default ({ children }) => <Layout meta={meta}>{children}</Layout>;

View File

@@ -36,6 +36,7 @@ if (typeof window !== "undefined") {
formbricks.init({
environmentId: "${environmentId}",
apiHost: "${window.location.protocol}//${window.location.host}",
logLevel: "debug", // remove when in production
});
}`}</CodeBlock>

View File

@@ -34,7 +34,7 @@ export default function WidgetStatusIndicator({ environmentId, type }: WidgetSta
icon: ArrowDownIcon,
color: "slate",
title: "Not implemented yet.",
subtitle: "The Formbricks widget has not yet been implemented.",
subtitle: "The Formbricks widget is neede to display surveys in your app.",
},
running: { icon: CheckIcon, color: "green", title: "Receiving data.", subtitle: "Last event received:" },
issue: {