JS: HOW TO USE COOKIES NOTIFICATION BOX

Cookies Notification Bar

You can use a custom Cookies notification bar which using a custom script. This is recommended for TLD's domain (Top Level Domain). If you are using a blogger ccTLD's domain (blogname.blogspot.com) read on 'Custom Cookies Notification for Blogger', but its freely to use this script too.


WHAT ARE COOKIES?


Cookies is the data or text information from the site that people visits and it stored on their browser, like Internet Explorer, Google Chrome, Mozilla Firefox, etc. This data helps the site for remembering any information that you've already visit, so next time you visits to that site again, you've already have some data on that site, it may called with offline data too in some case. Or to site that you have already log in state.



WEBSITE WITH COOKIES NOTIFICATION


You can find out or checks the problem for JavaScript which is encountering a problem like: 'Blocking Render JS' on pagespeed's check site.

And then, finally you can easily put this Custom EU Cookies Notification Bar on your template. This JavaScript is passed a Blocking Render JavaScript's rule:

<script type='text/javascript'>
//<![CDATA[
function loadCSS(e, t, n) { "use strict"; var i = window.document.createElement("link"); var o = t || window.document.getElementsByTagName("script")[0]; i.rel = "stylesheet"; i.href = e; i.media = "only x"; o.parentNode.insertBefore(i, o); setTimeout(function () { i.media = n || "all" }) }
loadCSS("//cdn.staticaly.com/gh/joniibra/webdev/blogger/widgets/en_US/cookies.notification/cookies.notification.box.css");
//]]>
</script>

<script type='text/javascript'>
//<![CDATA[
// Expires Header
jQuery.cookie=function(e,n,o){if(arguments.length>1&&"[object Object]"!==String(n)){if(o=jQuery.extend({},o),(null===n||void 0===n)&&(o.expires=-1),"number"==typeof o.expires){var t=o.expires,r=o.expires=new Date;r.setDate(r.getDate()+t)}return n=String(n),document.cookie=[encodeURIComponent(e),"=",o.raw?n:encodeURIComponent(n),o.expires?"; expires="+o.expires.toUTCString():"",o.path?"; path="+o.path:"",o.domain?"; domain="+o.domain:"",o.secure?"; secure":""].join("")}o=n||{};var i,c=o.raw?function(e){return e}:decodeURIComponent;return(i=new RegExp("(?:^|; )"+encodeURIComponent(e)+"=([^;]*)").exec(document.cookie))?c(i[1]):null};

// EU Law Cookies
window.addEventListener("load",function(){window.cookieconsent.initialise({palette:{popup:{background:"#eb6c44",text:"#ffffff"},button:{background:"#f5d948"}},theme:"edgeless",position:"bottom-right",content:{dismiss:"Got it",href:"/p/privacy-policies.html",title:"Privacy Policy"}})});
(function(){var e=document.createElement("script");e.async=true;e.type="text/javascript";e.src="//cdn.staticaly.com/gh/joniibra/webdev/blogger/widgets/en_US/cookies.notification/cookies.notification.box.js";(document.getElementsByTagName("HEAD")[0]||document.getElementsByTagName("BODY")[0]).appendChild(e)})();
</script>




ADSENSE WITH COOKIES

Some AdSense will not showing up in the site just because not using the cookies notification bar, it's because google has made a change to their policies. So, this notification is really important.


This Custom EU Cookies Notification Bar will only showing once time if the visitor has clicked the "Got It!" button for 356 days or 1 year. Except the visitors clears the browser's cookies.







Rebates Bonus
Exclusive Rebate

Sign up today and be the first to get notified on new updates.


LOAD DISCUSSION

0 comments:

Post a Comment