How to set up WooCommerce analytics with PostHog

Last updated:

|Edit this page

Getting traffic, usage, and user behavior data about your WooCommerce site is simple with PostHog. Once set up, PostHog gives you the tools to view session replays to understand customer behavior, use experiments to improve checkout flows, and run CSAT surveys to measure customer experience.

How to add PostHog to your WooCommerce site

After setting up your WooCommerce site, the easiest way to set up PostHog is to install the free Insert Headers and Footers plugin by WPCode.

After doing this, go into the Code Snippets section and add a new snippet. Once you're here, get your PostHog snippet with your project API key and instance address from your project settings. Paste it into the code editor, press Save, and activate it.

Code snippet

PostHog will now be capturing pageviews, button clicks, and more. You can also enable and use features like session replays, A/B testing, and surveys.

Depending on how you host your WooCommerce site, you may also be able to edit the theme function or header file which we detail in our WordPress docs.

Tracking conversions in WooCommerce

One of the most important metrics for an ecommerce site is conversion, like adding an item to your cart and completing the checkout.

PostHog has multiple tools to help you track and measure conversions. To do this without code, you can create an action using the toolbar. To do this:

  1. Go to the toolbar tab in PostHog, add your domain as an authorized URL, and click Launch.
  2. Go to the page on your WooCommerce site with your conversion button, click the lightning icon, then click New action, and then the conversion button.
  3. Fill out the details for your action like name and matching, and then click Create action. This creates an action you can see in the data management tab in PostHog.

Create action

Once this action is created, you can get an overview of conversions by going to the web analytics dashboard, clicking Add conversion goal, and then choosing your action. This shows you your total conversions, unique conversions, and conversion rate.

PostHog web analytics dashboard

To dive deeper into your conversions, you can use funnels to add multiple steps, break down by properties, and see timings.

Questions?

Was this page useful?

Next article

How to set up WordPress analytics with PostHog

Getting traffic, usage, and user behavior data about your WordPress site is simple with PostHog. Once you have that data, you can discover insights and build dashboards with our suite of analytics tools. How to add PostHog to your WordPress site The best way to add PostHog to your WordPress site depends on what version of WordPress you are using. All of them require you to signup for PostHog , get your snippet with your project API key and instance address from your project settings , and…

Read next article