mirror of
https://github.com/bigchaindb/site.git
synced 2024-11-22 09:46:57 +01:00
track social links with GA Custom Events
This commit is contained in:
parent
d9be25a66c
commit
2dc8de5719
@ -29,6 +29,31 @@ var GoogleAnalytics = (function(w,d,$) {
|
|||||||
$('.js-tracking-whitepaper-download').on('click', function() {
|
$('.js-tracking-whitepaper-download').on('click', function() {
|
||||||
ga('send', 'event', 'whitepaper', 'download', 'button', true);
|
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;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,13 +21,13 @@ quotes: set3
|
|||||||
<div class="grid__col">
|
<div class="grid__col">
|
||||||
<h1>Join the discussion</h1>
|
<h1>Join the discussion</h1>
|
||||||
<p>Participate via Gitter or Google Group</p>
|
<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">
|
<svg class="icon icon--social icon--gitter" aria-labelledby="title">
|
||||||
<title>Gitter</title>
|
<title>Gitter</title>
|
||||||
<use xlink:href="/assets/img/sprite.svg#gitter"></use>
|
<use xlink:href="/assets/img/sprite.svg#gitter"></use>
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</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">
|
<svg class="icon icon--social icon--github" aria-labelledby="title">
|
||||||
<title>Google Group</title>
|
<title>Google Group</title>
|
||||||
<use xlink:href="/assets/img/sprite.svg#google"></use>
|
<use xlink:href="/assets/img/sprite.svg#google"></use>
|
||||||
@ -38,23 +38,23 @@ quotes: set3
|
|||||||
<h1>Follow</h1>
|
<h1>Follow</h1>
|
||||||
<p>Follow us for the latest updates</p>
|
<p>Follow us for the latest updates</p>
|
||||||
<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">
|
<svg class="icon icon--social icon--github" aria-labelledby="title">
|
||||||
<title>GitHub</title>
|
<title>GitHub</title>
|
||||||
<use xlink:href="/assets/img/sprite.svg#github"></use>
|
<use xlink:href="/assets/img/sprite.svg#github"></use>
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</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">
|
<svg class="icon icon--social icon--twitter" aria-labelledby="title">
|
||||||
<title>Twitter</title>
|
<title>Twitter</title>
|
||||||
<use xlink:href="/assets/img/sprite.svg#twitter"></use>
|
<use xlink:href="/assets/img/sprite.svg#twitter"></use>
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</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">
|
<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>
|
<use xlink:href="/assets/img/sprite.svg#medium"></use>
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user