1
0
mirror of https://github.com/bigchaindb/site.git synced 2024-11-22 01:36:55 +01:00

track social links with GA Custom Events

This commit is contained in:
Matthias Kretschmann 2016-03-03 17:08:35 +01:00
parent d9be25a66c
commit 2dc8de5719
2 changed files with 31 additions and 6 deletions

View File

@ -29,6 +29,31 @@ var GoogleAnalytics = (function(w,d,$) {
$('.js-tracking-whitepaper-download').on('click', function() {
ga('send', 'event', 'whitepaper', 'download', 'button', true);
});
// Social links
$('.js-social-link').on('click', function() {
var href = this.getAttribute('href'),
network = extractDomain(href);
ga('send', 'event', 'social', 'click', network);
});
function extractDomain(url) {
var domain;
//find & remove protocol (http, ftp, etc.) and get domain
if (url.indexOf("://") > -1) {
domain = url.split('/')[2];
}
else {
domain = url.split('/')[0];
}
//find & remove port number
domain = domain.split(':')[0];
return domain;
}
},

View File

@ -21,13 +21,13 @@ quotes: set3
<div class="grid__col">
<h1>Join the discussion</h1>
<p>Participate via Gitter or Google Group</p>
<a class="social-link" href="https://gitter.im/{{ site.gitter }}">
<a class="social-link js-social-link" href="https://gitter.im/{{ site.gitter }}">
<svg class="icon icon--social icon--gitter" aria-labelledby="title">
<title>Gitter</title>
<use xlink:href="/assets/img/sprite.svg#gitter"></use>
</svg>
</a>
<a class="social-link" href="https://groups.google.com/forum/#!forum/{{ site.googlegroup }}">
<a class="social-link js-social-link" href="https://groups.google.com/forum/#!forum/{{ site.googlegroup }}">
<svg class="icon icon--social icon--github" aria-labelledby="title">
<title>Google Group</title>
<use xlink:href="/assets/img/sprite.svg#google"></use>
@ -38,23 +38,23 @@ quotes: set3
<h1>Follow</h1>
<p>Follow us for the latest updates</p>
<p>
<a class="social-link" href="https://github.com/{{ site.github.org }}">
<a class="social-link js-social-link" href="https://github.com/{{ site.github.org }}">
<svg class="icon icon--social icon--github" aria-labelledby="title">
<title>GitHub</title>
<use xlink:href="/assets/img/sprite.svg#github"></use>
</svg>
</a>
<a class="social-link" href="https://twitter.com/{{ site.twitter }}">
<a class="social-link js-social-link" href="https://twitter.com/{{ site.twitter }}">
<svg class="icon icon--social icon--twitter" aria-labelledby="title">
<title>Twitter</title>
<use xlink:href="/assets/img/sprite.svg#twitter"></use>
</svg>
</a>
<a class="social-link" href="https://medium.com/{{ site.medium }}">
<a class="social-link js-social-link" href="https://medium.com/{{ site.medium }}">
<svg class="icon icon--social icon--blog" aria-labelledby="title">
<title>Blog</title>
<title>Medium</title>
<use xlink:href="/assets/img/sprite.svg#medium"></use>
</svg>
</a>