Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for choosing the conversion counting method of each conversion event #204

Open
Stephen986 opened this issue May 23, 2023 · 6 comments

Comments

@Stephen986
Copy link
Contributor

Stephen986 commented May 23, 2023

GA4 allows for either counting multiple conversions in a session, or maxing out at one conversion per session (the traditional UA way). This can be configured separately for each conversion. Details here: https://support.google.com/analytics/answer/13366706?hl=en&utm_id=ad .

Currently, this package only supports the new way that counts multiple conversions in a session. There's two ways this could be supported:

  1. Either separate out the conversion events that should be counted uniquely from the ones that should be counted in total with different project variables. ie if you only want 1 'download' to count, but want multiple 'purchases' to count, you'd put this in your dbt_project:
    per_event_conversion_events:['purchase'] (EDIT: this should just be 'conversion_events' so that people on previous versions don't have to update)
    per_session_conversion_events:['download']
  2. For each conversion, add both a count_ field and a is____conversion field. ie a session with 3 purchases would have both a 'purchase_count' of 3 and an 'is_purchase_conversion' field of true.

Any thoughts on a preferred approach? I could attempt to implement.

@adamribaudo-velir
Copy link
Collaborator

I'm not sure I agree that the current implementation uses the 'once per session' methodology. As you can see in stg_ga4__session_conversions_daily, we simply run a countif on the conversion events (ce)

countif(event_name = '{{ce}}') as {{ce}}_count

So the current implementation is "once per event". If someone wanted to implement "once per session" it would be as simple as adding a new column calculated as {{ce}}_count >= 1 to the session fact table.

@Stephen986
Copy link
Contributor Author

@adamribaudo-velir I said the same thing: "Currently, this package only supports the new way that counts multiple conversions in a session."

@adamribaudo-velir
Copy link
Collaborator

Sorry, I was thinking the 'new way' is once-per-session because Google just released that feature as part of GA4 :)

Given that Google provides this feature as an on/off configuration in the property, I would suggest we do something similar rather than count using both methods and potentially confusing users. What I would propose is:

  • A new var conversion_count_method with values once-per-session and once-per-event that defaults to once-per-event
  • If once-per-session, Update stg_ga4__sessions_conversions and stg_ga4__sessions_conversions_daily to swap out the countif() expression for an expression that will return a 1 if any conversion event is in the session and 0 otherwise.

So the column names would remain the same, but the calculation method would change depending on the new variable.

@Stephen986
Copy link
Contributor Author

@adamribaudo-velir It's an on/off setting for each event!

@adamribaudo-velir
Copy link
Collaborator

oh wow. well that complicates things.

I'm ok with your option 1 but I'd like to support this in a way that doesn't require updates for existing users of the package. Perhaps we can keep the conversion_events variable and add a new, optional per_session_conversion_events variable as you describe.

I don't LOVE it, but it should make things smoother for users without causing too much confusion.

@Stephen986
Copy link
Contributor Author

@adamribaudo-velir Makes sense to not break things for existing users. Just updated the description.

@Stephen986 Stephen986 changed the title Support for choosing the conversion counting method Support for choosing the conversion counting method of each conversion event May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants