Framer
Contents
PostHog makes it easy to get data about traffic and usage of your Framer app. Integrating PostHog into your site enables analytics about user behavior, custom events capture, session recordings, feature flags, and more.
This guide walks you through integrating PostHog into your Framer app using the JavaScript Web SDK.
Installation
Go to your project settings and copy your web snippet. It looks like this:
With the JavaScript snippet copied, go to your Framer project and click the gear in the top right to go to your site settings. If you haven’t already, sign up for the "Mini" site plan. This enables you to add custom code.
Once on a paid plan, go to the General tab in site settings and scroll down to the Custom Code section. Under End of <head>
tag, paste your PostHog JavaScript snippet. Make sure to press Save next to the Custom Code heading.
Finally, publish your site to have PostHog automatically start capturing events.
Set up a reverse proxy (recommended)
We recommend setting up a reverse proxy, so that events are less likely to be intercepted by tracking blockers.
We have our own managed reverse proxy service included in the platform packages, which 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, AWS Cloudfront, and Vercel.
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.
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.
Capture custom events
To capture custom events, you call posthog.capture()
using custom code components in Framer.
Go to the Assets tab in the top left of your Framer project, and click the plus icon next to the Code tab. This will show a pop up to create a new code file. Name the file CaptureButton
, set it as a "New component" and press Create.
In the new code file, delete the existing code and replace it with the following:
Press Cmd/Ctrl + s
to save your changes. Then press the Home button to go back to the home page. Add your new CaptureButton
to your page by dragging it from the Code tab.
Publish your site and then click your new button to see the event in PostHog.
Next steps
For any technical questions for how to integrate specific PostHog features into Framer (such as analytics, feature flags, A/B testing, surveys, etc.), have a look at our JavaScript Web SDK docs.
Alternatively, the following tutorials can help you get started: