Skip to content

Map lowercase tagged sources to capitalized form during ingestion - #4417

Merged
ukutaht merged 3 commits into
masterfrom
source-capitalization
Aug 27, 2024
Merged

Map lowercase tagged sources to capitalized form during ingestion#4417
ukutaht merged 3 commits into
masterfrom
source-capitalization

Conversation

@ukutaht

@ukutaht ukutaht commented Aug 1, 2024

Copy link
Copy Markdown
Contributor

Changes

This work is in preparation of a bigger project - Acquisition Channel.

This PR changes how we handle manually tagged acquisition data. When links are manually tagged, usually the utm_source parameter has a value like google or facebook. However, when we automatically detect sources based on the Referer header, we store the source field as Google or Facebook. So then we have dashboards that have both sources google and Google where the first is manually tagged traffic and the second is automatically detected.

However, both are coming from the same source so we would like to merge the lowercase and the capitalized entry in sources.

The way I've decided to tackle it here is to build a lookup table from the RefInspector library that stores all sources in a table like:

lowercase(source) -> source

We use this table to lookup google -> Google during ingestion, for example.

The logic is that if the manually passed utm_source matches the lowercase form of any known traffic source, it gets transformed and stored as the capitalized form like automatically added sources.

We have also discussed a data migration for historical data to apply the same transformation. I'll look into that next.

Tests

  • Automated tests have been added

Changelog

  • Entry has been added to changelog

Documentation

  • Docs have been updated

Dark mode

  • This PR does not change the UI

Comment thread lib/mix/tasks/send_pageview.ex
@ukutaht
ukutaht requested a review from a team August 1, 2024 09:15
Comment thread lib/plausible/ingestion/acquisition.ex
@macobo

macobo commented Aug 12, 2024

Copy link
Copy Markdown
Contributor

This is missing a changelog entry.

@github-actions

Copy link
Copy Markdown
Preview environment👷🏼‍♀️🏗️
PR-4417

@ukutaht
ukutaht force-pushed the source-capitalization branch from 1a02d72 to 4145e3e Compare August 27, 2024 09:48
@ukutaht
ukutaht merged commit 2e89a50 into master Aug 27, 2024
@ukutaht
ukutaht deleted the source-capitalization branch August 27, 2024 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants