Ask or search…
Comment on page


In this tutorial we will show you how to integrate Posthog into your web application hosted on Codesphere and will show you some useful tricks how Codesphere and Posthog can work together. Posthog is a popular open source analytics stack with which you can analyze your user data to gain real world insights.

Creating a Posthog account

Navigate to and create a free account. The first 1 million events per month are free, so unless you are running a really high frequency site this will get you a long way.
After account creation select Web from the options provided and copy your personal snippet.
This snippet needs to go into the tag of your application. Depending on the tech stack you are using this will be slightly different. Posthog has guides for a variety of tech stacks i.e. (Wordpress)[].
Once you have the snipped in deploy your updates to production (see Staging Documentation for more deployments in Codesphere)
Click Continue in the Posthog setup wizard, it will ask you to open your site and click around a bit while Posthog is listening for captured events. After 60 seconds the first events should appear and Posthog will set up a basic analytics dashboard for you.
From there you can customize the dashboards to your needs, we will go through one example later.

Session recording

Posthog can also record user sessions, this will allow you to watch anonymized versions of your users while they interact with your application. This can be very useful to find user paths where people get lost or annoyed and even get a feeling where they would expect functionality that is currently still missing. If you want to set this up, open your Posthog dashboard, navigate to Recording, click configure and set the toggle for opt-in.

A/B tests & experiments with Posthog and Codesphere

Learn more about how A/B tests and experiments can be realized with Posthog and Codesphere in our tutorial
Last modified 6mo ago