1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Remove more Google Analytics references (#16194)

This commit is contained in:
Kevin Heis
2020-10-26 14:17:49 -07:00
committed by GitHub
parent 73e445de55
commit d743ff9512
5 changed files with 18 additions and 23 deletions

View File

@@ -2,29 +2,29 @@
<div class="container-xl px-3 px-md-6"> <div class="container-xl px-3 px-md-6">
<div class="d-flex flex-wrap py-5 mb-5"> <div class="d-flex flex-wrap py-5 mb-5">
<div class="col-12 col-lg-4 mb-5"> <div class="col-12 col-lg-4 mb-5">
<a href="https://github.com/" data-ga-click="Footer, go to home, text:home" class="text-gray-dark" aria-label="Go to GitHub homepage"> <a href="https://github.com/" class="text-gray-dark" aria-label="Go to GitHub homepage">
{% octicon "logo-github" height="30" %} {% octicon "logo-github" height="30" %}
</a> </a>
</div> </div>
<div class="col-6 col-sm-3 col-lg-2 mb-6 mb-md-2 pr-3 pr-lg-0 pl-lg-4"> <div class="col-6 col-sm-3 col-lg-2 mb-6 mb-md-2 pr-3 pr-lg-0 pl-lg-4">
<h4 class="mb-3 text-mono text-gray-light text-normal">{% data ui.footer.product.heading %}</h4> <h4 class="mb-3 text-mono text-gray-light text-normal">{% data ui.footer.product.heading %}</h4>
<ul class="list-style-none text-gray f5"> <ul class="list-style-none text-gray f5">
<li class="lh-condensed mb-3"><a href="https://github.com/features" data-ga-click="Footer, go to features, text:features" class="link-gray">{% data ui.footer.product.links.features %}</a></li> <li class="lh-condensed mb-3"><a href="https://github.com/features" class="link-gray">{% data ui.footer.product.links.features %}</a></li>
<li class="lh-condensed mb-3"><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security" class="link-gray">{% data ui.footer.product.links.security %}</a></li> <li class="lh-condensed mb-3"><a href="https://github.com/security" class="link-gray">{% data ui.footer.product.links.security %}</a></li>
<li class="lh-condensed mb-3"><a href="https://github.com/enterprise" data-ga-click="Footer, go to enterprise, text:enterprise" class="link-gray">{% data ui.footer.product.links.enterprise %}</a></li> <li class="lh-condensed mb-3"><a href="https://github.com/enterprise" class="link-gray">{% data ui.footer.product.links.enterprise %}</a></li>
<li class="lh-condensed mb-3"><a href="https://github.com/case-studies?type=customers" data-ga-click="Footer, go to case studies, text:case studies" class="link-gray">{% data ui.footer.product.links.case_studies %}</a></li> <li class="lh-condensed mb-3"><a href="https://github.com/case-studies?type=customers" class="link-gray">{% data ui.footer.product.links.case_studies %}</a></li>
<li class="lh-condensed mb-3"><a href="https://github.com/pricing" data-ga-click="Footer, go to pricing, text:pricing" class="link-gray">{% data ui.footer.product.links.pricing %}</a></li> <li class="lh-condensed mb-3"><a href="https://github.com/pricing" class="link-gray">{% data ui.footer.product.links.pricing %}</a></li>
<li class="lh-condensed mb-3"><a href="https://resources.github.com" data-ga-click="Footer, go to resources, text:resources" class="link-gray">{% data ui.footer.product.links.resources %}</a></li> <li class="lh-condensed mb-3"><a href="https://resources.github.com" class="link-gray">{% data ui.footer.product.links.resources %}</a></li>
</ul> </ul>
</div> </div>
<div class="col-6 col-sm-3 col-lg-2 mb-6 mb-md-2 pr-3 pr-md-0 pl-md-4"> <div class="col-6 col-sm-3 col-lg-2 mb-6 mb-md-2 pr-3 pr-md-0 pl-md-4">
<h4 class="mb-3 text-mono text-gray-light text-normal">{% data ui.footer.platform.heading %}</h4> <h4 class="mb-3 text-mono text-gray-light text-normal">{% data ui.footer.platform.heading %}</h4>
<ul class="list-style-none f5"> <ul class="list-style-none f5">
<li class="lh-condensed mb-3"><a href="https://developer.github.com/" data-ga-click="Footer, go to api, text:api" class="link-gray">{% data ui.footer.platform.links.developer_api %}</a></li> <li class="lh-condensed mb-3"><a href="https://developer.github.com/" class="link-gray">{% data ui.footer.platform.links.developer_api %}</a></li>
<li class="lh-condensed mb-3"><a href="http://partner.github.com/" data-ga-click="Footer, go to partner, text:partner" class="link-gray">{% data ui.footer.platform.links.partners %}</a></li> <li class="lh-condensed mb-3"><a href="http://partner.github.com/" class="link-gray">{% data ui.footer.platform.links.partners %}</a></li>
<li class="lh-condensed mb-3"><a href="https://atom.io" data-ga-click="Footer, go to atom, text:atom" class="link-gray">{% data ui.footer.platform.links.atom %}</a></li> <li class="lh-condensed mb-3"><a href="https://atom.io" class="link-gray">{% data ui.footer.platform.links.atom %}</a></li>
<li class="lh-condensed mb-3"><a href="http://electron.atom.io/" data-ga-click="Footer, go to electron, text:electron" class="link-gray">{% data ui.footer.platform.links.electron %}</a></li> <li class="lh-condensed mb-3"><a href="http://electron.atom.io/" class="link-gray">{% data ui.footer.platform.links.electron %}</a></li>
<li class="lh-condensed mb-3"><a href="https://desktop.github.com/" data-ga-click="Footer, go to desktop, text:desktop" class="link-gray">{% data ui.footer.platform.links.github_desktop %}</a></li> <li class="lh-condensed mb-3"><a href="https://desktop.github.com/" class="link-gray">{% data ui.footer.platform.links.github_desktop %}</a></li>
</ul> </ul>
</div> </div>
<div class="col-6 col-sm-3 col-lg-2 mb-6 mb-md-2 pr-3 pr-md-0 pl-md-4"> <div class="col-6 col-sm-3 col-lg-2 mb-6 mb-md-2 pr-3 pr-md-0 pl-md-4">

View File

@@ -14,7 +14,7 @@ const maxContentLength = 300
const hasStandaloneSearch = () => document.getElementById('landing') || document.querySelector('body.error-404') !== null const hasStandaloneSearch = () => document.getElementById('landing') || document.querySelector('body.error-404') !== null
const resultTemplate = (item) => { const resultTemplate = (item) => {
// Attach an `algolia-query` param to each result link so Google Analytics // Attach an `algolia-query` param to each result link so analytics
// can track the search query that led the user to this result // can track the search query that led the user to this result
const input = document.querySelector('#search-input-container input') const input = document.querySelector('#search-input-container input')
if (input) { if (input) {
@@ -189,12 +189,12 @@ export default function () {
searchWithYourKeyboard('#search-input-container input', '.ais-Hits-item') searchWithYourKeyboard('#search-input-container input', '.ais-Hits-item')
toggleSearchDisplay() toggleSearchDisplay()
// delay removal of the query param so Google Analytics client code has a chance to track it // delay removal of the query param so analytics client code has a chance to track it
setTimeout(() => { removeAlgoliaQueryTrackingParam() }, 500) setTimeout(() => { removeAlgoliaQueryTrackingParam() }, 500)
} }
// When a user performs an in-site search an `agolia-query` param is // When a user performs an in-site search an `algolia-query` param is
// added to the URL so Google Analytics can track the queries and the pages // added to the URL so analytics can track the queries and the pages
// they lead to. This function strips the query from the URL after page load, // they lead to. This function strips the query from the URL after page load,
// so the bare article URL can be copied/bookmarked/shared, sans tracking param // so the bare article URL can be copied/bookmarked/shared, sans tracking param
function removeAlgoliaQueryTrackingParam () { function removeAlgoliaQueryTrackingParam () {

View File

@@ -8,7 +8,6 @@ module.exports = contentSecurityPolicy({
defaultSrc: ["'none'"], defaultSrc: ["'none'"],
connectSrc: [ connectSrc: [
"'self'", "'self'",
'*.google-analytics.com',
'*.algolia.net', '*.algolia.net',
'*.algolianet.com' '*.algolianet.com'
], ],
@@ -19,7 +18,6 @@ module.exports = contentSecurityPolicy({
], ],
imgSrc: [ imgSrc: [
"'self'", "'self'",
'*.google-analytics.com',
'github.githubassets.com', 'github.githubassets.com',
'github-images.s3.amazonaws.com', 'github-images.s3.amazonaws.com',
'octodex.github.com', 'octodex.github.com',
@@ -32,8 +30,7 @@ module.exports = contentSecurityPolicy({
"'self'", "'self'",
'data:', 'data:',
"'unsafe-eval'", // exception for Algolia instantsearch "'unsafe-eval'", // exception for Algolia instantsearch
"'unsafe-inline'", "'unsafe-inline'"
'*.google-analytics.com'
], ],
frameSrc: [ // exceptions for GraphQL Explorer frameSrc: [ // exceptions for GraphQL Explorer
'https://graphql-explorer.githubapp.com', // production env 'https://graphql-explorer.githubapp.com', // production env

View File

@@ -49,14 +49,12 @@ describe('server', () => {
expect(csp.get('connect-src').includes('*.algolianet.com')).toBe(true) expect(csp.get('connect-src').includes('*.algolianet.com')).toBe(true)
expect(csp.get('img-src').includes("'self'")).toBe(true) expect(csp.get('img-src').includes("'self'")).toBe(true)
expect(csp.get('img-src').includes('*.google-analytics.com')).toBe(true)
expect(csp.get('img-src').includes('github-images.s3.amazonaws.com')).toBe(true) expect(csp.get('img-src').includes('github-images.s3.amazonaws.com')).toBe(true)
expect(csp.get('img-src').includes('octodex.github.com')).toBe(true) expect(csp.get('img-src').includes('octodex.github.com')).toBe(true)
expect(csp.get('script-src').includes("'self'")).toBe(true) expect(csp.get('script-src').includes("'self'")).toBe(true)
expect(csp.get('script-src').includes("'unsafe-eval'")).toBe(true) // exception for Algolia instantsearch expect(csp.get('script-src').includes("'unsafe-eval'")).toBe(true) // exception for Algolia instantsearch
expect(csp.get('script-src').includes("'unsafe-inline'")).toBe(true) expect(csp.get('script-src').includes("'unsafe-inline'")).toBe(true)
expect(csp.get('script-src').includes('*.google-analytics.com')).toBe(true)
expect(csp.get('style-src').includes("'self'")).toBe(true) expect(csp.get('style-src').includes("'self'")).toBe(true)
expect(csp.get('style-src').includes("'unsafe-inline'")).toBe(true) expect(csp.get('style-src').includes("'unsafe-inline'")).toBe(true)

View File

@@ -3,7 +3,7 @@ const { head } = require('../helpers')
describe('developer.github.com redirects', () => { describe('developer.github.com redirects', () => {
jest.setTimeout(30 * 60 * 1000) jest.setTimeout(30 * 60 * 1000)
it('responds with 200 for the top historical request paths from google analytics', async () => { it('responds with 200 for the top historical request paths', async () => {
// ignore paths that are not (yet?) being redirected from developer.github.com to docs.github.com // ignore paths that are not (yet?) being redirected from developer.github.com to docs.github.com
const ignoredPatterns = [ const ignoredPatterns = [
/^\/changes/, /^\/changes/,