Skip to content

Instantly share code, notes, and snippets.

@robhammond
Created July 10, 2018 08:38
Show Gist options
  • Save robhammond/b7537ce40eaf24d23bc1908cd58f1012 to your computer and use it in GitHub Desktop.
Save robhammond/b7537ce40eaf24d23bc1908cd58f1012 to your computer and use it in GitHub Desktop.
Custom Acquisition channel - Data Studio
CASE
WHEN ((Source="direct" AND Medium="(not set)") OR Medium="(none)") THEN "Direct"
WHEN Medium="organic" THEN "Organic Search"
WHEN (Social Source Referral="Yes" OR REGEXP_MATCH(Medium,"^(social|social-network|social-media|sm|social network|social media)$")) OR REGEXP_MATCH(Source,"(facebook|t.co|reddit|fark|linkedin|pinterest)") THEN "Social"
WHEN Medium="email" THEN "Email"
WHEN Medium="referral" and not(REGEXP_MATCH(Source,"(facebook|t.co|reddit|fark|linkedin|pinterest)") ) THEN "Referral"
ELSE "(Other)"
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment