You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice if we can set default props (context) to be sent with every pageview event. So that we can use enableAutoPageviews()
Detailed Description
Right now we can only send custom props with pageviews events using the trackPageview() function.
As a customer who's a multi-tenancy platform provider, I benefit from the simple implementation of the tracker by using enableAutoPageviews(), but if we want to set custom props (e.g. subscription-plan) we'll need to opt-out from using enableAutoPageviews and write our own logic to track every pageview with the desired props
Possible Implementation
I can think of 2 implementations that might work here
1- Allow EventOptions to be passed to enableAutoPageviews
While this might be the simplest to implement, I'm not a big fan of this approach as it would make updating the eventOptions a bit challenging.
2- Add a pageviewProps option to Plausible definition and setPageviewProps to the plausible instance
I'm in favor with this approach as it's easy to use and can be introduced without any breaking changes
consttracker=Plausible({domain: "plausible.io",pageviewProps: {isLoggedIn: "No"}});// auto track pageviewstracker.enableAutoPageviews()// and then to update it when neededtracker.setPageviewProps({subscriptionPlan: "Enterprise",isLoggedIn: "Yes", ...others})
I'm happy to open a PR with either approaches if needed
The text was updated successfully, but these errors were encountered:
It would be nice if we can set default props (context) to be sent with every pageview event. So that we can use
enableAutoPageviews()
Detailed Description
Right now we can only send custom props with pageviews events using the
trackPageview()
function.As a customer who's a multi-tenancy platform provider, I benefit from the simple implementation of the tracker by using
enableAutoPageviews()
, but if we want to set custom props (e.g.subscription-plan
) we'll need to opt-out from usingenableAutoPageviews
and write our own logic to track every pageview with the desired propsPossible Implementation
I can think of 2 implementations that might work here
1- Allow EventOptions to be passed to
enableAutoPageviews
While this might be the simplest to implement, I'm not a big fan of this approach as it would make updating the
eventOptions
a bit challenging.2- Add a
pageviewProps
option to Plausible definition andsetPageviewProps
to the plausible instanceI'm in favor with this approach as it's easy to use and can be introduced without any breaking changes
I'm happy to open a PR with either approaches if needed
The text was updated successfully, but these errors were encountered: