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

Remove GA from website #927

Merged
merged 1 commit into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ marked:
deploy:
type:

# Analytics
google_analytics: UA-101540923-1

# Algolia
appId: 0R8E5SPAFP
apiKey: 2ee58f908e6d720c4f72a9645ce0e857
Expand Down
2 changes: 1 addition & 1 deletion src/webhint-theme/layout/partials/footer.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ul>
<% nav.items && nav.items.forEach((item) => { %>
<li>
<a href="<%= item.link %>" data-ga-category="docs" data-ga-action="<%= item.title %>" data-ga-label="footer"><%= item.title %></a>
<a href="<%= item.link %>"><%= item.title %></a>
</li>
<% }); %>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion src/webhint-theme/layout/partials/home.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<label for="home-scan" class="visually-hidden">Type your URL here</label>
<div class="input-fix">
<input id="home-scan" type="url" name="url" placeholder="Type your URL here">
<button type="submit" class="button--red" type="submit" data-ga-category="scanner" data-ga-action="start" data-ga-label="homepage">Run Scan</button>
<button type="submit" class="button--red" type="submit">Run Scan</button>
</div>
</form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/webhint-theme/layout/partials/scan-form.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
<label for="scanner-page-scan">Enter your URL here</label>
<div class="input-fix">
<input id="scanner-page-scan" type="url" name="url" value="<%= scanUrl || '' %>" placeholder="Type your URL here">
<button class="button--red" type="submit" data-ga-category="scanner" data-ga-action="start" data-ga-label="scanner">Run Scan</button>
<button class="button--red" type="submit">Run Scan</button>
</div>
</form>
</section>
Expand Down
10 changes: 0 additions & 10 deletions src/webhint-theme/layout/partials/scripts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,3 @@
});
}());
</script>

<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', '<%= theme.google_analytics %>', 'auto');
ga('set', 'transport', 'beacon')
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>

31 changes: 0 additions & 31 deletions src/webhint-theme/source/js/gdpr.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global ga:false */
(function () {
/** Creates a cookie. Code based on https://www.quirksmode.org/js/cookies.html */
var createCookie = function (name, value, days) {
Expand Down Expand Up @@ -51,34 +50,4 @@
}

createCookie('consent', 'on', 30);

// Track events code

var arraify = function (elements) {
return [].slice.call(elements);
};

var handleClickEvent = function (e) {
var target = e.target;

if (target) {
var action = target.getAttribute('data-ga-action'); // required
var category = target.getAttribute('data-ga-category'); // required
var label = target.getAttribute('data-ga-label');
var value = parseInt(target.getAttribute('data-ga-value'), 10) || void 0;

if (!ga ||
!category) {
return;
}

ga('send', 'event', category, action, label, value);
}
};

var actions = arraify(document.querySelectorAll('[data-ga-action]'));

actions.forEach(function(element){
element.addEventListener('click', handleClickEvent, false);
});
}());