Skip to content

Commit

Permalink
Cookie consent (#823)
Browse files Browse the repository at this point in the history
  • Loading branch information
begriffs committed Dec 10, 2018
1 parent 9fc6133 commit 4392572
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 13 deletions.
96 changes: 96 additions & 0 deletions _static/css/citus.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,99 @@ h1,h2,.rst-content .toctree-wrapper p.caption,h3,h4,h5,h6,legend {
div.wy-menu.rst-pro {
display: none !important;
}

/* Cookie consent */

#consentBox {
border-radius: 1em 1em 0 0;
padding: 1.5em;
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: none;
z-index: 9999999999;
width: 450px;
max-width: 100%;
background-color: rgba(0, 0, 0, .9);
color: #e7e7e7;
font-size: 0.8em;
font-weight: 300;
text-align: left;
overflow: hidden;
letter-spacing: 0.02em;
line-height: 1.4;
box-shadow: 0 0 0 #239f49, 0 0 10px #239f49;
}
@media screen and (min-width: 480px) {
#consentBox {
margin: 0 1em;
}
}
#consentBox .consent-text {
padding-left: 2.5em;
position: relative;
}
#consentBox .consent-text a {
text-decoration: underline;
}
#consentBox .consent-text:before {
content: "i";
font-size: 1.25em;
position: absolute;
top: 0;
left: 0;
line-height: 22px;
text-align: center;
border: #e7e7e7 1px solid;
width: 25px;
height: 25px;
border-radius: 50%;
font-style: italic;
font-weight: 400;
box-sizing: border-box;
}
#consentBox .btn {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-color: #239f49;
border: 0;
border-radius: 3px;
color: #ffffff;
cursor: pointer;
display: inline-block;
font-family: "Lato", sans-serif;
font-size: 1em;
font-weight: 700;
-webkit-font-smoothing: antialiased;
line-height: 1;
padding: 1.125em 3em;
text-align: center;
text-decoration: none;
-webkit-transition: background-color 150ms ease;
transition: background-color 150ms ease;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
vertical-align: middle;
white-space: nowrap;
}
#consentBox .btn:hover {
background-color: #2cc95c;
color: #ffffff;
outline: none;
}
#consentBox .consent-button {
margin-top: 1.5em;
padding-left: 2.5em;
}
#consentBox p:last-of-type {
margin-bottom: 0;
}

#consentBox .consent-text a { color: #239f49; transition: color .2s ease; }
#consentBox .consent-text a:hover, #consentBox .consent-text a:focus { color: #2cc95c; }
#consentBox .consent-text a:visited { color: #239f49; }
#consentBox .consent-text p { font-size: inherit; line-height: inherit; }
91 changes: 87 additions & 4 deletions _templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
{# Verify the site for Google Webmaster Tools #}
<meta name="google-site-verification" content="v8MtCUC2nV2dO-4CSGb5flD1MyPKJvw7wBDOYRwBadw" />

{# fonts for cookie consent box #}
<link href="https://fonts.googleapis.com/css?family=Lato:300,300i,400,400i,700,700i" rel="stylesheet" />

{# Last in <head> to override any canonical link that sphinx adds #}
{% if pagename in canonical_urls %}
<link rel="canonical" href="{{ canonical_urls[pagename] }}" />
Expand All @@ -25,6 +28,21 @@
{{ super() }}
{% endblock %}

{% block body %}

{{ super() }}

<div class="new" id="consentBox">
<div class="consent-text">
<p>This site uses cookies for analytics, personalized content and ads. By continuing to browse this site, you agree to this use. <a href="https://www.citusdata.com/privacy#cookies" id="cookiesLink">Learn&nbsp;more</a>.</p>
</div>
<div class="consent-button">
<button class="btn" id="closeConsent">CLOSE</button>
</div>
</div>

{% endblock %}

{% block footer %}
{{ super() }}

Expand All @@ -33,10 +51,75 @@
window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=t.forceSSL||"https:"===document.location.protocol,a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=(r?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+e+".js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n);for(var o=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","removeEventProperty","setEventProperties","track","unsetEventProperty"],c=0;c<p.length;c++)heap[p[c]]=o(p[c])};
heap.load("4002524638");
</script>
{# Segment #}

{# Drift chat #}
<script>
!function() {
var t;
if (t = window.driftt = window.drift = window.driftt || [], !t.init) return t.invoked ? void (window.console && console.error && console.error("Drift snippet included twice.")) : (t.invoked = !0,
t.methods = [ "identify", "config", "track", "reset", "debug", "show", "ping", "page", "hide", "off", "on" ],
t.factory = function(e) {
return function() {
var n;
return n = Array.prototype.slice.call(arguments), n.unshift(e), t.push(n), t;
};
}, t.methods.forEach(function(e) {
t[e] = t.factory(e);
}), t.load = function(t) {
var e, n, o, i;
e = 3e5, i = Math.ceil(new Date() / e) * e, o = document.createElement("script"),
o.type = "text/javascript", o.async = !0, o.crossorigin = "anonymous", o.src = "https://js.driftt.com/include/" + i + "/" + t + ".js",
n = document.getElementsByTagName("script")[0], n.parentNode.insertBefore(o, n);
});
}();
drift.SNIPPET_VERSION = '0.3.1';
drift.load('kntc8ig2awfp');

window.drift.on("startConversation", function() {
window.ga("send", "event", "Drift", "startConversation");
});
</script>

{# cookie consent dialog #}

<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js'></script>

<script type="text/javascript">
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="4.0.0";
analytics.load("TKfha8eC8r4TBLXXQhGyc6rmGud8nVa0");
}}();
$(document).ready(function() {
var cookieConsent = 'CitusCookieConsentCorner',
consentValue = 'Consented';

var clickConsent = function () {
if ($("#consentBox").is(":visible")) {
// although the dialog is at the bottom of the screen,
// "slideUp" actually makes it sink downward...
$("#consentBox").slideUp("linear");
$.cookie(cookieConsent, consentValue, {
expires: 365,
path: '/'
});
}
};

// continuing to interact with the page consents to cookies
$("a:not(#cookiesLink), button, iframe, input, [data-toggle]").on(
"click", clickConsent
);

if (typeof(drift) == 'object' && typeof(drift.on) == 'function') {
// ditto drift interaction
drift.on('ready', function (api) {
drift.on('welcomeMessage:open', clickConsent);
drift.on('awayMessage:open', clickConsent);
});
} else {
console.log("Drift not found by cookie consent code");
}

if ($.cookie(cookieConsent) != consentValue) {
// "slideDown" makes the dialog pop up!
$("#consentBox").slideDown("linear");
}
});
</script>
{% endblock %}
9 changes: 0 additions & 9 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,3 @@ Welcome to the documentation for Citus 8.0! Citus horizontally scales PostgreSQL
:width: 0%
.. image:: images/cloud-bill-ach.png
:width: 0%

.. raw:: html

<script type="text/javascript">
setTimeout(function(){var a=document.createElement("script");
var b=document.getElementsByTagName("script")[0];
a.src=document.location.protocol+"//script.crazyegg.com/pages/scripts/0052/6282.js?"+Math.floor(new Date().getTime()/3600000);
a.async=true;a.type="text/javascript";b.parentNode.insertBefore(a,b)}, 1);
</script>

0 comments on commit 4392572

Please sign in to comment.