Skip to content

Instantly share code, notes, and snippets.

@taylorgorman
Created May 14, 2024 20:53
Show Gist options
  • Save taylorgorman/3190c3e5948d655d0a23b70b2785ea99 to your computer and use it in GitHub Desktop.
Save taylorgorman/3190c3e5948d655d0a23b70b2785ea99 to your computer and use it in GitHub Desktop.
Google Looker Studio field formula to group Session Sources typically split up by subdomain. Pairs well with Session Channel Group.
IF( CONTAINS_TEXT( Session source, "facebook" ), "Facebook",
IF( CONTAINS_TEXT( Session source, "fb" ), "Facebook",
IF( CONTAINS_TEXT( Session source, "ig" ), "Instagram",
IF( CONTAINS_TEXT( Session source, "instagram" ), "Instagram",
IF( CONTAINS_TEXT( Session source, "Instagram" ), "Instagram",
IF( CONTAINS_TEXT( Session source, "linkedin" ), "LinkedIn",
IF( CONTAINS_TEXT( Session source, "lnkd.in" ), "LinkedIn",
IF( CONTAINS_TEXT( Session source, "t.co" ), "Twitter",
IF( CONTAINS_TEXT( Session source, "pinterest" ), "Pinterest",
IF( CONTAINS_TEXT( Session source, "reddit" ), "Reddit",
IF( CONTAINS_TEXT( Session source, "linktree" ), "Linktree",
Session source
)))))))))))
@taylorgorman
Copy link
Author

Needs more conditions, I'm sure. Feel free to suggest!

To add to a data source from a report: Resource → Manage added data sources → Edit → Add a Field → Add calculated field → Field Name = Session source group; Formula = paste the above pile of IF statements. → Save.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment