Velir/dbt-ga4

Channel definition mis-match results in SMS traffic attributing as Organic Social

Closed this issue · 1 comments

dgitis commented

This rule in our default_channel_grouping macro

  when REGEXP_CONTAINS({{source}}, r"^(facebook|instagram|pinterest|reddit|twitter|linkedin)") = true
    or REGEXP_CONTAINS({{medium}}, r"^(social|social-network|social-media|sm|social network|social media)") = true
    or {{source_category}} = 'SOURCE_CATEGORY_SOCIAL' 
    then 'Organic Social'

precedes this rule.

  when {{medium}} = 'sms'
    then 'SMS'

The regexp_contains(medium, r'sm') rule matches sms and thus prevents the SMS rule from firing.

Google's definition is Medium is one of (“social”, “social-network”, “social-media”, “sm”, “social network”, “social media”).

Is there a reason why our rule doesn't match here? Or was that just an oversight.

We can either fix this by switching the rule to medium in (“social”, “social-network”, “social-media”, “sm”, “social network”, “social media”) and match Google's definition or we can move the SMS rule to fire before the Organic Social rule.

Do you have any preferences @adamribaudo-velir ?

Yea interesting. Must have been an oversight. I like the first option. Will implement now.