mirror of
https://github.com/bigchaindb/site.git
synced 2024-11-22 09:46:57 +01:00
add cookies banner, refactor whole GA loading flow
This commit is contained in:
parent
f9f61badb7
commit
13a3a85880
@ -2,6 +2,7 @@
|
|||||||
//=include svg4everybody/dist/svg4everybody.js
|
//=include svg4everybody/dist/svg4everybody.js
|
||||||
//=include jquery/dist/jquery.js
|
//=include jquery/dist/jquery.js
|
||||||
//=include smooth-scroll/dist/js/smooth-scroll.js
|
//=include smooth-scroll/dist/js/smooth-scroll.js
|
||||||
|
//=include cookies-eu-banner/dist/cookies-eu-banner.js
|
||||||
|
|
||||||
//=include bigchain/analytics.js
|
//=include bigchain/analytics.js
|
||||||
//=include bigchain/dnt.js
|
//=include bigchain/dnt.js
|
||||||
@ -15,10 +16,6 @@ jQuery(function($) {
|
|||||||
//
|
//
|
||||||
Forms.init()
|
Forms.init()
|
||||||
|
|
||||||
if (!_dntEnabled()) {
|
|
||||||
GoogleAnalytics.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// init Smooth Scroll
|
// init Smooth Scroll
|
||||||
|
6
_src/_includes/cookie-banner.html
Normal file
6
_src/_includes/cookie-banner.html
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<div id="cookies-eu-banner" style="display: none;">
|
||||||
|
By continuing your visit to this site, you accept the use of cookies by Google Analytics to make visits statistics.
|
||||||
|
<a href="./read-more.html" id="cookies-eu-more">Read more</a>
|
||||||
|
<button id="cookies-eu-reject">Reject</button>
|
||||||
|
<button id="cookies-eu-accept">Accept</button>
|
||||||
|
</div>
|
@ -1,17 +1,11 @@
|
|||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
//
|
//
|
||||||
// Site scripts
|
// Site scripts
|
||||||
//
|
//
|
||||||
-->
|
-->
|
||||||
<script src="/assets/js/bigchain.min.js"></script>
|
<script src="/assets/js/bigchain.min.js"></script> {% if page.js %}
|
||||||
|
<script src="/assets/js/{{ page.js }}"></script> {% elsif layout.js %}
|
||||||
{% if page.js %}
|
<script src="/assets/js/{{ layout.js }}"></script> {% endif %}
|
||||||
<script src="/assets/js/{{ page.js }}"></script>
|
|
||||||
{% elsif layout.js %}
|
|
||||||
<script src="/assets/js/{{ layout.js }}"></script>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
svg4everybody.js
|
svg4everybody.js
|
||||||
@ -26,13 +20,26 @@ svg4everybody.js
|
|||||||
-->
|
-->
|
||||||
<script>
|
<script>
|
||||||
if (!_dntEnabled()) {
|
if (!_dntEnabled()) {
|
||||||
|
new CookiesEuBanner(function () {
|
||||||
(function (window) {
|
(function (window) {
|
||||||
|
|
||||||
// Google Analytics async snippet
|
// Google Analytics async snippet
|
||||||
// http://goo.gl/3FPNDx
|
// http://goo.gl/3FPNDx
|
||||||
window.ga = window.ga || function () { (ga.q = ga.q || []).push(arguments) };
|
window.ga = window.ga || function () { (ga.q = ga.q || []).push(arguments) };
|
||||||
ga.l = +new Date;
|
ga.l = +new Date;
|
||||||
|
|
||||||
|
var d=document,
|
||||||
|
g=d.createElement('script'),
|
||||||
|
s=d.getElementsByTagName('script')[0];
|
||||||
|
g.async=true;
|
||||||
|
|
||||||
|
{% if jekyll.environment == "production" %}
|
||||||
|
g.src='https://www.google-analytics.com/analytics.js';
|
||||||
|
{% else %}
|
||||||
|
g.src='https://www.google-analytics.com/analytics_debug.js';
|
||||||
|
{% endif%}
|
||||||
|
|
||||||
|
s.parentNode.insertBefore(g,s);
|
||||||
|
|
||||||
// Create the GA tracker
|
// Create the GA tracker
|
||||||
ga('create', '{{ site.analyticsID }}', 'auto', { siteSpeedSampleRate: 10 });
|
ga('create', '{{ site.analyticsID }}', 'auto', { siteSpeedSampleRate: 10 });
|
||||||
|
|
||||||
@ -55,51 +62,17 @@ if (!_dntEnabled()) {
|
|||||||
|
|
||||||
// Track uncaught errors
|
// Track uncaught errors
|
||||||
window.onerror = function (message, url, line, col) {
|
window.onerror = function (message, url, line, col) {
|
||||||
var desc = message + ' (line: ' + line + ', url: ' + url + ', col: '
|
var desc = message + ' (line: ' + line + ', url: ' + url + ', col: ' + col + ')';
|
||||||
+ col + ')';
|
|
||||||
|
|
||||||
ga('send', 'exception', {
|
ga('send', 'exception', {
|
||||||
exDescription: 'window.onerror: ' + desc,
|
exDescription: 'window.onerror: ' + desc,
|
||||||
exFatal: false
|
exFatal: false
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
}(window));
|
}(window));
|
||||||
|
|
||||||
|
GoogleAnalytics.init()
|
||||||
|
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% if jekyll.environment == "production" %}
|
|
||||||
<script async src="//www.google-analytics.com/analytics.js"></script>
|
|
||||||
{% else %}
|
|
||||||
<script async src="//www.google-analytics.com/analytics_debug.js"></script>
|
|
||||||
{% endif%}
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
|
||||||
//
|
|
||||||
// Disqus comments
|
|
||||||
//
|
|
||||||
-->
|
|
||||||
{% if page.comments %}
|
|
||||||
<script>
|
|
||||||
var disqus_config = function () {
|
|
||||||
this.page.url = '{{ site.url }}{{ page.url }}';
|
|
||||||
this.page.identifier = '{{ page.id }}';
|
|
||||||
this.page.title = '{{ page.title }}';
|
|
||||||
};
|
|
||||||
|
|
||||||
{% if jekyll.environment == "development" %}
|
|
||||||
var disqus_developer = 1;
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
var d = document, s = d.createElement('script');
|
|
||||||
|
|
||||||
s.src = '//{{ site.disqus }}.disqus.com/embed.js';
|
|
||||||
|
|
||||||
s.setAttribute('data-timestamp', +new Date());
|
|
||||||
(d.head || d.body).appendChild(s);
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
|
|
||||||
{% endif %}
|
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
{% include footer.html %}
|
{% include footer.html %}
|
||||||
|
|
||||||
|
{% include cookie-banner.html %}
|
||||||
|
|
||||||
{% include scripts.html %}
|
{% include scripts.html %}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
"bigchaindb-driver": "^4.0.0",
|
"bigchaindb-driver": "^4.0.0",
|
||||||
"bootstrap": "^4.1.0",
|
"bootstrap": "^4.1.0",
|
||||||
"clipboard": "^2.0.0",
|
"clipboard": "^2.0.0",
|
||||||
|
"cookies-eu-banner": "^1.2.10",
|
||||||
"gumshoe": "github:cferdinandi/gumshoe",
|
"gumshoe": "github:cferdinandi/gumshoe",
|
||||||
"is-in-viewport": "^3.0.0",
|
"is-in-viewport": "^3.0.0",
|
||||||
"jquery": "^3.3.1",
|
"jquery": "^3.3.1",
|
||||||
|
Loading…
Reference in New Issue
Block a user