# Bubble Surveys installation - Docs

1.  1

    ## Copy the web snippet

    Required

    First, copy your PostHog web snippet:

    HTML

    PostHog AI

    ```html
    <script>
        !function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="init capture register register_once register_for_session unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group identify setPersonProperties setPersonPropertiesForFlags resetPersonPropertiesForFlags setGroupPropertiesForFlags resetGroupPropertiesForFlags resetGroups onFeatureFlags addFeatureFlagsHandler onSessionId getSurveys getActiveMatchingSurveys renderSurvey canRenderSurvey getNextSurveyStep".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
        posthog.init('<ph_project_token>', {
            api_host: 'https://us.i.posthog.com',
            defaults: '2026-01-30'
        })
    </script>
    ```

2.  2

    ## Add to Bubble

    Required

    Go to your Bubble site settings by clicking on the icon in the left-hand menu. If you haven't already, sign up for at least the **Starter** site plan. This enables you to add custom code. Then:

    1.  Go to the **SEO / metatags** tab in site settings.
    2.  Paste your PostHog snippet in the **Script/meta tags in header** section.
    3.  Deploy your site to live.

3.  3

    ## Send events

    Click around and view a couple pages to generate some events. PostHog automatically captures pageviews, clicks, and other interactions for you.

    If you'd like, you can also manually capture custom events:

    JavaScript

    PostHog AI

    ```javascript
    posthog.capture('my_custom_event', { property: 'value' })
    ```

4.  4

    ## Next steps

    Recommended

    After installing the PostHog SDK, you can create your first survey.

    | Resource | Description |
    | --- | --- |
    | [Creating surveys](/docs/surveys/creating-surveys.md) | Learn how to build and customize your surveys |
    | [Targeting surveys](/docs/surveys/targeting.md) | Show surveys to specific users based on properties, events, or feature flags |
    | [How to create custom surveys](/tutorials/survey.md) | Build advanced survey experiences with custom code |
    | [Framework guides](/docs/surveys/tutorials.md#framework-guides) | Setup guides for React, Next.js, Vue, and other frameworks |
    | [More tutorials](/docs/surveys/tutorials.md) | Other real-world examples and use cases |

    You should also [identify](/docs/product-analytics/identify.md) users and [capture events](/docs/product-analytics/capture-events.md) with PostHog to control who and when to show surveys to your users.

    Not all survey features are available on every SDK. See the [SDK feature support matrix](/docs/surveys/sdk-feature-support.md) for a full comparison.

### Community questions

Ask a question

### Was this page useful?

HelpfulCould be better