How to configure analytics for github pages

By | March 21, 2022

Code is a great way to communicate things but many a times we have felt the lack of documentation with it. To be able to serve that documentation along with the code makes it easier to maintain and share.

How to configure analytics for github pages
Restack, Posthog, Airbyte and analytics for github pages

Github pages

I am a fan of github pages for the ability it provides to build good looking documentation sites for the project along with building the project. After creating and sharing code of some personal projects, I also leveraged github pages for its documentation. Below are a few sites:

How to configure analytics

Github’s insights is great but not enough to understand more about user behaviour. So i had the below set of tasks to be done now:

Sl .NoTaskApproach
1Identify analytics providerLearnt about Posthog on Re-stack platform. Its an open source product analytics platform.
2Setup account with PosthogStarted my Posthog instance on Re-stack
3Embed analytics code on github This took some time to figure out as i am new to jekyll based sites. I found out we need to embed code from Posthog by creating head-custom.html (with the analytics code) inside _includes folder.

What does Posthog do

By default, it captures pageview, pageleave and autocapture events and persists. You can also create dashboards even without doing analytics. The opportunity is endless. It also comes with plugins which makes few things easier. One of them being when a user leaves a page, the plugin calculates the time difference between the pageview before and the pageleave. Below are some screenshots of the Posthog dashboard I have created.

See also  Publish blog posts from Github to
Users spending more than 3 minutes on a page
Users spending more than 3 minutes on a page
Unique users and referring domain
Unique users and referring domain

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.