posthog-js icon indicating copy to clipboard operation
posthog-js copied to clipboard

TypeError: posthog.setPersonProperties is not a function with JS Snippet

Open SergioNR opened this issue 1 year ago • 1 comments

Hello,

I'm setting up PostHog via GTM with the web snippet from https://eu.posthog.com/project/19615/settings/project#snippet but when I call posthog.setPersonProperties via GTM I got the Uncaught TypeError: posthog.setPersonProperties is not a function error 😢

image

What im doing / How to reproduce:

  1. Load web snippet (https://eu.posthog.com/project/19615/settings/project#snippet) via Google Tag Manager on "page initialization" (No issues here) image
  2. Execute the posthog.setPersonProperties function via Google Tag Manager on page initializacion with Tag Sequencing active to only execute AFTER posthog web snippet has ran (here is the issue) image
  3. Check DevTools and find "Uncaught TypeError: posthog.setPersonProperties is not a function" error

I'm using PostHog cloud with the free plan.

Anything I missed? Thanks!

PS: Might be related to https://github.com/PostHog/posthog-js/issues/702 where posthog.setPersonProperties is not being exposed by the web snippet?

SergioNR avatar May 30 '24 08:05 SergioNR

Fixed - Following indications like #702 , i exposed the function on my own and its working now --> image

SergioNR avatar May 30 '24 08:05 SergioNR

resolved in https://github.com/PostHog/posthog/pull/23662

pauldambra avatar Jul 11 '24 21:07 pauldambra