Skip to content

Instantly share code, notes, and snippets.

@hamletbatista
Created March 26, 2019 21:38
Show Gist options
  • Save hamletbatista/b36a2ac8900840448405510f55cf068b to your computer and use it in GitHub Desktop.
Save hamletbatista/b36a2ac8900840448405510f55cf068b to your computer and use it in GitHub Desktop.
Track performance of URL group in Data Studio with a generated regex
categories = """https://www.site.com/category/name1
https://www.site.com/category/name2
https://www.site.com/category/name3
"""
from urllib.parse import urlparse
"|".join([ urlparse(x).path for x in categories.split()])
#example output: '/category/name1|/category/name2|/category/name3'
#create a landing page filter in Data Studio, select RegExp Contains and copy and paste the regex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment