Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a couple of analytics tools #210

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 189 additions & 1 deletion tests/tracking_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,57 @@
if has_hotjar(url_and_content):
analytics[text.format(request_friendly_name,
'Hotjar')] = True
if has_adobe_analytics(url_and_content):
analytics[text.format(request_friendly_name,
'Adobe Analytics')] = True
if has_new_relic(url_and_content):
analytics[text.format(request_friendly_name,
'New Relic')] = True
if has_mixpanel(url_and_content):
analytics[text.format(request_friendly_name,
'Mixpanel')] = True
if has_quantcast(url_and_content):
analytics[text.format(request_friendly_name,
'Quantcast Measure')] = True
if has_fullstory(url_and_content):
analytics[text.format(request_friendly_name,
'Fullstory')] = True
if has_simple_analytics(url_and_content):
analytics[text.format(request_friendly_name,
'Simple Analytics')] = True
if has_cloudflare_insights(url_and_content):
analytics[text.format(request_friendly_name,
'Cloudflare Insights')] = False
if has_umami(url_and_content):
analytics[text.format(request_friendly_name,
'Umami')] = True
if has_yandex_metrika(url_and_content):
analytics[text.format(request_friendly_name,
'Yandex Metrika')] = False
if has_snowplow(url_and_content):
analytics[text.format(request_friendly_name,
'Snowplow')] = True
if has_klaviyo(url_and_content):
analytics[text.format(request_friendly_name,
'Klaviyo')] = True
if has_microsoft_clarity(url_and_content):
analytics[text.format(request_friendly_name,
'Microsoft Clarity')] = False
if has_clicky(url_and_content):
analytics[text.format(request_friendly_name,
'Clicky')] = True
if has_heap(url_and_content):
analytics[text.format(request_friendly_name,
'Heap')] = True
if has_pingdom_rum(url_and_content):
analytics[text.format(request_friendly_name,
'Pingdom RUM')] = True
if has_crazyegg(url_and_content):
analytics[text.format(request_friendly_name,
'Crazyegg')] = True
if has_sitegainer(url_and_content):
analytics[text.format(request_friendly_name,
'SiteGainer')] = True

return analytics

Expand Down Expand Up @@ -907,6 +958,144 @@

return False

def has_adobe_analytics(content):
# Look for javascript objects
if 'window.adobe.OptInCategories' in content:
return True

# Look for file names
if 'assets.adobedtm.com' in content:

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High test

The string
assets.adobedtm.com
may be at an arbitrary position in the sanitized URL.
return True

return False

def has_new_relic(content):
# Look for file names
if 'js-agent.newrelic.com' in content:

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High test

The string
js-agent.newrelic.com
may be at an arbitrary position in the sanitized URL.
return True

return False

def has_mixpanel(content):
# Look for file names
if 'cdn.mxpnl.com' in content:

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High test

The string
cdn.mxpnl.com
may be at an arbitrary position in the sanitized URL.
return True

return False

def has_quantcast(content):
# Look for file names
if 'quantserve.com/quant.js' in content:
return True

return False

def has_fullstory(content):
# Look for file names
if 'fullstory.com/s/fs.js' in content:
return True

return False

def has_simple_analytics(content):
# Look for file names
if 'scripts.simpleanalyticscdn.com' in content:

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High test

The string
scripts.simpleanalyticscdn.com
may be at an arbitrary position in the sanitized URL.
return True

return False

def has_cloudflare_insights(content):
# Look for file names
if 'static.cloudflareinsights.com/beacon.min.js' in content:
return True

return False

def has_umami(content):
# Look for file names
if '/umami.js' in content:
return True

return False

def has_yandex_metrika(content):
# Look for file names
if 'yandex.ru/metrika/tag.js' in content:
return True
if 'yandex.ru/metrika/watch.js' in content:
return True

return False

def has_snowplow(content):
# Look for javascript objects
if 'window.GlobalSnowplowNamespace' in content:
return True
if 'window.snowday' in content:
return True

# Look for file names
if '/snowplow-' in content:
return True
if '/snowday' in content:
return True

return False

def has_klaviyo(content):
# Look for file names
if 'static.klaviyo.com' in content:

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High test

The string
static.klaviyo.com
may be at an arbitrary position in the sanitized URL.
return True
if 'klaviyo.js?company_id=' in content:
return True

return False

def has_microsoft_clarity(content):
# Look for file names
if 'c.clarity.ms' in content:
return True
if 'www.clarity.ms/tag' in content:
return True
if '/clarity.js' in content:
return True

return False

def has_clicky(content):
# Look for file names
if 'static.getclicky.com/js' in content:
return True

return False

def has_heap(content):
# Look for file names
if 'cdn.heapanalytics.com/js/heap' in content:
return True

return False

def has_pingdom_rum(content):
# Look for file names
if 'rum-static.pingdom.net' in content:

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High test

The string
rum-static.pingdom.net
may be at an arbitrary position in the sanitized URL.
return True

return False

def has_crazyegg(content):
# Look for file names
if 'script.crazyegg.com/' in content:

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High test

The string
script.crazyegg.com/
may be at an arbitrary position in the sanitized URL.
return True

return False

def has_sitegainer(content):
# Look for file names
if 'cdn-sitegainer.com' in content:

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High test

The string
cdn-sitegainer.com
may be at an arbitrary position in the sanitized URL.
return True

return False

def has_matomo(content):
# Look for cookie name
Expand Down Expand Up @@ -963,7 +1152,6 @@

return False


def has_google_tagmanager(content):
# Look for file names
if 'googletagmanager.com/gtm.js' in content:
Expand Down
Loading