Merge pull request #422 from Microsoft/octref/cookie

GA and MSCC cookie
This commit is contained in:
Pine 2018-03-19 08:31:01 -07:00 committed by GitHub
commit 7bbf0ff49a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 5 deletions

View file

@ -0,0 +1,16 @@
<div id='mscc-cookie-container'>
<div id='msccBanner' dir='ltr' data-site-name='uhf-code.visualstudio.com' data-mscc-version='0.4.0' data-nver='aspnet-2.0.7'
data-sver='0.1.2' class='cc-banner' role='alert'>
<div class='cc-container'>
<svg class='cc-icon cc-v-center' x='0px' y='0px' viewBox='0 0 44 44' height='30px' fill='none' stroke='currentColor'>
<circle cx='22' cy='22' r='20' stroke-width='2'></circle>
<line x1='22' x2='22' y1='18' y2='33' stroke-width='3'></line>
<line x1='22' x2='22' y1='12' y2='15' stroke-width='3'></line>
</svg>
<span class='cc-v-center cc-text'>This site uses cookies for analytics, personalized content and ads. By continuing to browse this site, you agree to
this use.</span>
<a href='https://go.microsoft.com/fwlink/?linkid=845480' aria-label='Learn more about Microsoft&#39;s Cookie Policy'
id='msccLearnMore' class='cc-link cc-v-center cc-float-right' data-mscc-ic='false'>Learn more</a>
</div>
</div>
</div>

View file

@ -6,6 +6,8 @@
<title>{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}</title>
<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">
<link rel="stylesheet" href="//uhf.microsoft.com/mscc/statics/mscc-0.4.0.min.css">
<!-- link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous" -->
<link rel="stylesheet" href="{{ "/css/bootswatch/cosmo/bootstrap.min.css" | prepend: site.baseurl }}">
<link rel="stylesheet" href="{{ "/css/fontawesome-all.min.css" | prepend: site.baseurl }}">
@ -14,5 +16,4 @@
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}" />
</head>

View file

@ -1,7 +1,14 @@
<script>
var baseurl = '{{ site.baseurl }}'
</script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<!-- MicroSoft cookie library -->
<script src="https://uhf.microsoft.com/mscc/statics/mscc-0.4.0.min.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-62780441-30"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
<script async defer src="https://buttons.github.io/buttons.js"></script>

View file

@ -4,7 +4,7 @@
{% include head.html %}
<body>
{% include cookie_notice.html %}
{% include topnav.html %}
<div class="page-content">

View file

@ -1,3 +1,29 @@
$("#small-nav-dropdown").change(function() {
window.location = $(this).find("option:selected").val();
});
$('#small-nav-dropdown').change(function() {
window.location = $(this)
.find('option:selected')
.val()
})
$(function() {
// Load GA upfront because we classify it as essential cookie
window.dataLayer = window.dataLayer || []
function gtag() {
dataLayer.push(arguments)
}
gtag('js', new Date())
gtag('config', 'UA-62780441-30', { anonymize_ip: true })
if (mscc) {
if (!mscc.hasConsent()) {
window.addEventListener('click', function() {
if (!mscc.hasConsent()) {
mscc.setConsent()
}
})
// Where future non-essential tracking cookie need to go
mscc.on('consent', function() {
})
}
}
})