Integrate PostHog with Shopify

Last updated:


Integrating PostHog with your Shopify store

Why is this useful?

Tracking how users use your Shopify store can help you improve the user experience and increase conversion rates on your e-shop.


To follow this tutorial along, you should:

  1. Have deployed PostHog or be using PostHog Cloud.

Step-by-step instructions

  1. Get your PostHog snippet from your 'Project Settings' or the initial PostHog setup

  2. Login to your Shopify dashboard

  3. Go to 'Online Store' -> 'Themes' (see image below)

  4. On your theme, click 'Actions' -> 'Edit code' (see image below)

    Shopify Dashboard

  5. You should now be seeing a code editor. Click on theme.liquid under 'Layout' on the left sidebar (see image below)

  6. Navigate until you see the closing </head> tag. Paste your snippet there, before that tag, like in the image below:

    Shopify Dashboard

  7. Click the green save button on the top right and you're good to go - PostHog should now be working on your Shopify store!

To confirm PostHog is configured correctly, visit your store and then check if the events from your session appear in PostHog. Note that this may take a few minutes.

Ask a question