---
title: "PostHog and Framer: How to Connect Them (2026)"
description: "Add PostHog to a Framer site by pasting PostHog's JavaScript snippet into Framer's Custom Code section, in the head on all pages, and publishing. Framer."
url: https://www.shaheermalik.com/integrations/posthog
language: en
format: agent view of this page (the same content as the page, as plain text)
updated: 2026-11-23
---

[Integrations](https://www.shaheermalik.com/integrations) · Analytics

# PostHog and Framer: how to connect them

Add PostHog to a Framer site by pasting PostHog's JavaScript snippet into Framer's Custom Code section, in the head on all pages, and publishing. Framer also has its own analytics, with custom events tracked through its useTracking hook in code overrides or components.

[Framer site in 14 days](https://www.shaheermalik.com/shipitlive/framer-website-in-14-days) [All integrations](https://www.shaheermalik.com/integrations)

At a glance

- How it connects Custom code
- Where in Framer Site Settings, Custom Code
- Checked 29 October 2026

By [Shaheer Malik](https://www.shaheermalik.com/about) · Source: [Framer Help: How to track custom events in Framer](https://www.framer.com/help/articles/how-to-track-custom-events-in-framer/), read on 29 October 2026

**Quick answer:** Add PostHog to a Framer site by pasting PostHog's JavaScript snippet into Framer's Custom Code section, in the head on all pages, and publishing. Framer also has its own analytics, with custom events tracked through its useTracking hook in code overrides or components.

## How to connect PostHog to Framer

1. Copy the PostHog JavaScript snippet from your PostHog account
2. In Framer, open Site Settings and the Custom Code section, then add a new script
3. Paste the snippet, give it a clear name and choose where it goes: usually the head, on all pages
4. Choose whether it runs once or on every page visit, as the tool's instructions say
5. Publish the site, then check the tool's dashboard for the first visit

## Good to know

- Framer's own analytics can track custom events with its useTracking hook; IDs must be lowercase with hyphens
- Session replay can capture typed text; configure masking before going live

## How custom code works in Framer

Framer's Custom Code section, in Site Settings, is where tracking scripts and chat widgets go. Framer's help lists analytics and marketing tags, chat and support widgets, small CSS and JavaScript tweaks, and structured data as its uses. For each snippet you choose:

- **Placement:** the start or end of the head, or the start or end of the body
- **Pages:** every page, or only the pages you select, including CMS pages
- **When it runs:** once, or on every page visit

## Before you add tracking

- Check the consent rules for where your visitors are, and add a consent banner if you need one
- Mask typed text in any tool that records sessions
- Install each tool once, so page views are not counted twice
- Test on the published site, not the editor preview, and watch page speed after adding scripts

## At a glance

| Tool | PostHog |
| --------------- | -------------------------- |
| Category | Analytics |
| How it connects | Custom code |
| Where in Framer | Site Settings, Custom Code |

## PostHog and Framer questions

### Can I use PostHog on a Framer site?

Yes. Its JavaScript snippet goes in Framer's Custom Code section like any analytics tag.

### Does Framer have its own analytics?

Yes, and it can track custom events through the useTracking hook in a code override or code component.

## Related integrations

- [Segment and Framer](https://www.shaheermalik.com/integrations/segment): custom code
- [Hotjar and Framer](https://www.shaheermalik.com/integrations/hotjar): custom code
- [Google Analytics and Framer](https://www.shaheermalik.com/integrations/google-analytics): a built-in setting

Every integration is on the [integrations](https://www.shaheermalik.com/integrations) page. If you would rather have the site built with this already connected, the [Framer website sprint](https://www.shaheermalik.com/shipitlive/framer-website-in-14-days) is $1,500 fixed for 14 days.

Work I designed and built

[ Silver Cat Boats Marine / Luxury · 2024](https://www.shaheermalik.com/case-studies/silver-cat-boats) [ Quadzio SaaS · 2024](https://www.shaheermalik.com/case-studies/quadzio-case-study) [ EagleRider Website Redesign Travel & Mobility · 2024](https://www.shaheermalik.com/case-studies/eaglerider-website-redesign)

Shown as the standard of work. Each project had its own scope and price. [All case studies](https://www.shaheermalik.com/case-studies)

## Want it connected for you?

I design and build Framer sites with analytics, forms and integrations set up, for a fixed $1,500 in 14 days.

[See the Framer sprint](https://www.shaheermalik.com/shipitlive/framer-website-in-14-days) [Get in touch](https://www.shaheermalik.com/contact)

Only need a marketing site of up to 25 pages? The [fixed-price website](https://www.shaheermalik.com/fixed-price-website) is $1,500, designed and built in Framer and live in 14 days.

## What you can do here
- Get a fixed-price proposal: https://www.shaheermalik.com/proposal/chat (describe the project in a sentence or two)
- Free website audit: https://www.shaheermalik.com/audit?site=example.com (replace example.com with the site; the score needs no email)
- Book a free scope call: https://www.shaheermalik.com/fixed-price-website#book
- Contact: https://www.shaheermalik.com/contact
- Prices and facts for the whole site: https://www.shaheermalik.com/llms.txt

## Structured data

```json
{
 "@context": "https://schema.org",
 "@type": "HowTo",
 "name": "How to connect PostHog to a Framer site",
 "description": "Add PostHog to a Framer site by pasting PostHog's JavaScript snippet into Framer's Custom Code section, in the head on all pages, and publishing. Framer also has its own analytics, with custom events tracked through its useTracking hook in code overrides or components.",
 "url": "https://www.shaheermalik.com/integrations/posthog",
 "step": [
  {
   "@type": "HowToStep",
   "position": 1,
   "name": "Copy the PostHog JavaScript snippet from your PostHog account",
   "text": "Copy the PostHog JavaScript snippet from your PostHog account"
  },
  {
   "@type": "HowToStep",
   "position": 2,
   "name": "In Framer, open Site Settings and the Custom Code section, then add a new script",
   "text": "In Framer, open Site Settings and the Custom Code section, then add a new script"
  },
  {
   "@type": "HowToStep",
   "position": 3,
   "name": "Paste the snippet, give it a clear name and choose where it goes: usually the head, on all pages",
   "text": "Paste the snippet, give it a clear name and choose where it goes: usually the head, on all pages"
  },
  {
   "@type": "HowToStep",
   "position": 4,
   "name": "Choose whether it runs once or on every page visit, as the tool's instructions say",
   "text": "Choose whether it runs once or on every page visit, as the tool's instructions say"
  },
  {
   "@type": "HowToStep",
   "position": 5,
   "name": "Publish the site, then check the tool's dashboard for the first visit",
   "text": "Publish the site, then check the tool's dashboard for the first visit"
  }
 ]
}
```
