PostHog
PostHog is a product analytics platform used to track visitor behaviour on websites through event tracking, session recordings, heatmaps, and on-site surveys.
Key features include:
- Behaviour and event tracking
- Conversion funnel analysis
- Session replay
- Heatmaps
- On-site surveys
- Web performance metrics
PostHog integrates with ShopWired by loading a site-wide to record visitor interactions and display analytics-driven overlays on the ShopWired website.
Account creation
Account creation
Create an account on the PostHog website. Once the account is created and configured, PostHot will provide a JavaScript tracking snippet.
Theme installation
Theme installation
PostHog provides a JavaScript snippet that must be added to the ShopWired website theme, similar to the example shown below:
<script>
!function(t,e){var o,n,p,r;e.__SV||(window.posthog&&window.posthog.__loaded)||(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.crossOrigin="anonymous",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 unregister identify reset on off".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('PROJECT_API_KEY', {
api_host: 'https://eu.i.posthog.com'
})
</script>
The script shown above is provided as an example only. You must copy the exact script provided in your own account, as the script and any ID values will be unique to your website.
Add the PostHog snippet to the ShopWired theme:
- Navigate to Website > Themes
- Select the
code editoroption for the theme to be edited. - Open the
master.twigfile. - Paste the PostHog JavaScript snippet provided by PostHog just above the closing
</head>tag. - Select
save changes
PostHog can now record visitor interactions and display analytics-driven overlays on the ShopWired website.
Recommendations
Recommendations
- Review PostHog privacy and data capture settings to ensure compliance with applicable data protection requirements.