cal-itp / benefits

Transit benefits enrollment, minus the paperwork.
https://docs.calitp.org/benefits
GNU Affero General Public License v3.0
26 stars 9 forks source link

Add custom properties for UTM code information #2034

Closed thekaveman closed 4 months ago

thekaveman commented 4 months ago

We are proposing to use UTM codes in query strings for various Benefits outreach campaigns. Read more about UTM codes in this article from Hubspot: https://blog.hubspot.com/marketing/what-are-utm-tracking-codes-ht

We need to implement these properties into the Amplitude analytics tracking to be able to later gauge campaign effectiveness.

The proposal is to add them as event_properties and user_properties in the viewed page event. This is likely the first event that a user following a tracked URL will generate. And having the properties on both the event and the user makes later analysis in Amplitude more flexible.

Acceptance Criteria

Additional context

UTM code information comes from the query string, accessible via the Django request.GET attribute, an instance of QueryDict.

indexing commented 4 months ago

@thekaveman I've defined the parameters for our campaign tracking URLs below. Please review and let me know if you note any issues, as we will share these with MST for them to share with Transit.

Tracking URLs for Transit App Campaign

Older adults

Parameter Value
base URL https://benefits.calitp.org
utm_source transitapp
utm_campaign mst_benefits
utm_medium banner
utm_content olderadults_EN
utm_id may2024

Parameter Value
base URL https://benefits.calitp.org
utm_source transitapp
utm_campaign mst_benefits
utm_medium banner
utm_content olderadults_SP
utm_id may2024

Veterans

Parameter Value
base URL https://benefits.calitp.org
utm_source transitapp
utm_campaign mst_benefits
utm_medium banner
utm_content veterans_EN
utm_id may2024

Parameter Value
base URL https://benefits.calitp.org
utm_source transitapp
utm_campaign mst_benefits
utm_medium banner
utm_content veterans_SP
utm_id may2024
thekaveman commented 4 months ago

@indexing these all look good! I think my only note is the field utm_id should be utm_term -- utm_id isn't one of the standard fields.

Note that our implementation here does not depend on the specific values we choose for this TransitApp banner campaign. But we do need to align on the field names.

thekaveman commented 3 months ago

@indexing I hope it's not too late -- I just thought of a small fix we should make to those URLs that get shared in the banner...

We can direct users straight to the MST index page, so they don't have to have another interaction selecting their transit agency, by adding /mst to the end of the path, before the UTM codes e.g.

https://benefits.calitp.org/mst?utm_source=transitapp&utm_medium=banner&utm_campaign=mst_benefits&utm_id=may2024&utm_content=olderadults_EN

indexing commented 3 months ago

This approach is definitely optimal. I've reached out to our contact at Transit app to see about making the change. Hopefully I'll have an update on Monday.