<script src="https://cc.cdn.civiccomputing.com/8.0/cookieControl-8.0.min.js"></script>
<script>
	window.acceptAnalyticsCookies = false;
	window.acceptMarketingCookies = false;

	var config = {
		apiKey: '<%= tracking.cookieControl %>',
		product: 'PRO',
		initialState: "OPEN",
		statement : {
			description: 'For more detailed information on the cookies we use, please check our',
			name : 'Privacy Policy',
			url: 'https://chamaileon.io/privacy-policy.html',
			updated : '08/08/2016'
		},
		necessaryCookies: ["accessToken", "chamaileonAccessToken", "chamaileon-test", "showCookie", "layoutEditorVideo"],
		optionalCookies: [
			{
				name: 'analytics',
				label: 'Analytics',
				description: '',
				initialConsentState: "on",
				cookies: ["_ga", "_gat", "_gid", "_hjIncludedInSample", "mf_user", "mp_<%= tracking.mixpanel %>_mixpanel"],
				onAccept : function(){
					window.acceptAnalyticsCookies = true;

					// hotjar
					(function(h,o,t,j,a,r){
						h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
						h._hjSettings={hjid:<%= tracking.hotjar %>,hjsv:6};
						a=o.getElementsByTagName('head')[0];
						r=o.createElement('script');r.async=1;
						r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
						a.appendChild(r);
					})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');

					// GA
					var gaToken = "<%= tracking.gaToken %>";
					(function (i, s, o, g, r, a, m) {
						i['GoogleAnalyticsObject'] = r;
						i[r] = i[r] || function () {
							(i[r].q = i[r].q || []).push(arguments)
						}, i[r].l = 1 * new Date();
						a = s.createElement(o),
							m = s.getElementsByTagName(o)[0];
						a.async = 1;
						a.src = g;
						m.parentNode.insertBefore(a, m)
					})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

					ga("create", gaToken, "auto");

					ga("send", "pageview");
					ga("send", "event", location.host, "page-landing", "Page Landing");

					// mixpanel
					(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
					0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
					for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]);
					mixpanel.init("<%= tracking.mixpanel %>");

					// Facebook Pixel Code
					!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
					n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
					n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
					t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
					document,'script','https://connect.facebook.net/en_US/fbevents.js');
					fbq('init', '<%= tracking.facebook %>'); // Insert your pixel ID here.
					fbq('track', 'PageView');
				},
				onRevoke: function(){}
			},{
				name: 'marketing',
				label: 'Marketing',
				description: '',
				initialConsentState: "on",
				cookies: ["AID"],
				onAccept : function(){
					window.acceptMarketingCookies = true;

					// gaRemarketing
					/* <![CDATA[ */
					var google_conversion_id = <%= tracking.gaRemarketing %>;
					var google_custom_params = window.google_tag_params;
					var google_remarketing_only = true;
					/* ]]> */
				},
				onRevoke: function(){}
			}
		],

		position: 'LEFT',
		theme: 'DARK',
		branding: {
			fontColor: "#FFF",
			backgroundColor: "#00bee6",
			fontSizeTitle: "1.2em",
			fontSizeIntro: "1em",
			fontSizeHeaders: "1em",
			fontSize: "0.8em",
			toggleText: "#000",
			toggleColor: "#00bee6",
			toggleBackground: "#FFF",
			buttonIcon: null,
			buttonIconWidth: "64px",
			buttonIconHeight: "64px",
			removeIcon: false,
			removeAbout: false
		}
	};
	
	(function(callback) {
		CookieControl.load(config);
		setTimeout(callback, 0);
	})(function () {
		CookieControl.toggleCategory(0);
		CookieControl.toggleCategory(1);
	});
</script>