|
1 | 1 | try { |
2 | | - if (app.config.env == 'production') { |
3 | | - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
4 | | - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
5 | | - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
6 | | - })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
7 | | - ga('create', 'UA-5544833-12', 'devdocs.io'); |
8 | | - page.track(function() { |
9 | | - ga('send', 'pageview', { |
10 | | - page: location.pathname + location.search + location.hash, |
11 | | - dimension1: app.router.context && app.router.context.doc && app.router.context.doc.slug_without_version |
| 2 | + if (app.config.env === 'production') { |
| 3 | + if (Cookies.get('analyticsConsent') === '1') { |
| 4 | + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
| 5 | + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
| 6 | + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
| 7 | + })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
| 8 | + ga('create', 'UA-5544833-12', 'devdocs.io'); |
| 9 | + page.track(function() { |
| 10 | + ga('send', 'pageview', { |
| 11 | + page: location.pathname + location.search + location.hash, |
| 12 | + dimension1: app.router.context && app.router.context.doc && app.router.context.doc.slug_without_version |
| 13 | + }); |
12 | 14 | }); |
13 | | - }); |
14 | 15 |
|
15 | | - page.track(function() { |
16 | | - if (window._gauges) |
17 | | - _gauges.push(['track']); |
18 | | - else |
19 | | - (function() { |
20 | | - var _gauges=_gauges||[];!function(){var a=document.createElement("script"); |
21 | | - a.type="text/javascript",a.async=!0,a.id="gauges-tracker", |
22 | | - a.setAttribute("data-site-id","51c15f82613f5d7819000067"), |
23 | | - a.src="https://secure.gaug.es/track.js";var b=document.getElementsByTagName("script")[0]; |
24 | | - b.parentNode.insertBefore(a,b)}(); |
25 | | - })(); |
26 | | - }); |
| 16 | + page.track(function() { |
| 17 | + if (window._gauges) |
| 18 | + _gauges.push(['track']); |
| 19 | + else |
| 20 | + (function() { |
| 21 | + var _gauges=_gauges||[];!function(){var a=document.createElement("script"); |
| 22 | + a.type="text/javascript",a.async=!0,a.id="gauges-tracker", |
| 23 | + a.setAttribute("data-site-id","51c15f82613f5d7819000067"), |
| 24 | + a.src="https://secure.gaug.es/track.js";var b=document.getElementsByTagName("script")[0]; |
| 25 | + b.parentNode.insertBefore(a,b)}(); |
| 26 | + })(); |
| 27 | + }); |
| 28 | + } else { |
| 29 | + resetAnalytics(); |
| 30 | + } |
27 | 31 | } |
28 | 32 | } catch(e) { } |
0 commit comments