Problem/Motivation
posthog_php is very helpful, because Server-side events are much more reliable, e.g. for tracking conversions like "Commerce: Order completed". Sadly they are not very well-connected to client-side created user profiles and Posthog told us that it might make sense to trigger the event also client-side.
Steps to reproduce
Trigger a server-side event and see that it's disconnected from the client session, at least if there's no person profile.
Proposed resolution
Discuss adding a setting to trigger the event client-side, e.g. through AJAX or the general server response via JS.
This should be configurable, at least a general setting in posthog_php for now, because there may be server-side events (e.g. API) that never have a frontend or there may be other reasons why passing the event to the client might not be what you want.
Maybe there's even a more clever way to solve this or just don't use posthog_php for these events, but still keep them reliable? Typical cases are the submodule cases like posthog_webform or posthog_commerce server-side events, which work great, but are just a bit too disconnected.
Comments