Possibility to "accumulate" properties ?
allan-simon opened this issue · 3 comments
I would like to use posthog in a symfony php application , due to the it's architectured I would like to do the following
- when the "User" constructed to set some of his properties in posthog internal state (the same as the
::init()
will save the api key) - Later in some place where it's not convenient to access the user object to be able to capture events with the pre-saved user properties
is it something possible to do ?
Hi Allan,
Do the properties need to remain only in state on the client?
Could you call
PostHog::identify(array(
'distinctId' => 'user:123',
'properties' => array(
'theInformation' => 'I want to save',
)
));
And then call the API to query for events by property
e.g. to find events where a custom person is as above you would call
https://app.posthog.com/api/projects/2/events/?properties=[{"key":"theInformation","value":["I want to save"],"operator":"exact","type":"person"}]&orderBy=["-timestamp"]
Would that work for you?
thanks your remark permitted me to refine my problem
the main problem i face is I may call PostHog::capture in some place where having the user:123
is not easily accessible so regardless if i was able to do identify with most of properties set at this moment. I would be missing the "distinctId" that permits to link the event to that user
so yes my problem is more "Could it be possible to tell posthog to keep a 'current distinct id' "
Hmm, that's how the JS SDK works...
If I make a call to identify
and then on the same device make a call to capture
I can see that the captured event is from an identified user
We link the two together so we know the event comes from the user
I'm completely new to the PHP library, and don't know symfony at all.
Is the problem that Symfony is stopping that happening, or that the PHP library doesn't do it?