Permalink
Browse files

remove google/facebook tracking from referer URLs

  • Loading branch information...
mackuba committed Jan 26, 2019
1 parent 69b7390 commit 891addf8ebb4f92085fd075e6f8f667691c6811f
Showing with 6 additions and 0 deletions.
  1. +6 −0 import_logs.py
@@ -2510,6 +2510,12 @@ def filtered_line(line, reason):
if hit.referrer == '-':
hit.referrer = ''

hit.referrer = re.sub(r'&', '&', hit.referrer)
hit.referrer = re.sub(r'&?utm_\w+=[^&]*', '', hit.referrer)
hit.referrer = re.sub(r'&?fbclid=[^&]*', '', hit.referrer)
hit.referrer = re.sub(r'\?&', '?', hit.referrer)
hit.referrer = re.sub(r'\?$', '', hit.referrer)

try:
hit.user_agent = format.get('user_agent')

0 comments on commit 891addf

Please sign in to comment.