google cache gives api key error

68 views
Skip to first unread message

Jennie05

unread,
Oct 7, 2015, 7:20:41 AM10/7/15
to Cookie Control Support
We have noted that when viewing our website through google cache it gives an error stating the apikey is not valid?  Is this correct as works fine on our site normally?


Jeff C.

unread,
Mar 22, 2016, 6:47:48 PM3/22/16
to Cookie Control Support
Did you solve this issue? I'm getting this today on the cached pages google has cached of one of my sites.

Jennie05

unread,
Mar 31, 2016, 7:23:51 AM3/31/16
to Cookie Control Support
sadly not, never got a response from Civic

Gerasimos Tzoganis

unread,
Mar 31, 2016, 7:34:19 AM3/31/16
to Cookie Control Support
Hello,

When you view a website via google cache, you are actually on google's domain, not the one you registered your license for, so the apikey is not valid there.

If you want to workaround that, you could simply wrap the initialisation script in an if, so that it only runs on your domain, something like this:

if (window.location.hostname.indexOf ("mydomain.com") >= 0) {
  cookieControl({
      t: {
 title: '<p>This site uses cookies to store information on your computer.</p>',
 intro: '<p>Some of these cookies are essential to make our site work and others help us to improve by giving us some insight into how the site is being used.</p>',
 full:'<p>These cookies are set when you submit a form, login or interact with the site by doing something that goes beyond clicking some simple links.</p><p>We also use some non-essential cookies to anonymously track visitors or enhance your experience of this site. If you\'re not happy with this, we won\'t set these cookies but some nice features on the site may be unavailable.</p><p>To control third party cookies, you can also <a class="ccc-settings" href="http://www.civicuk.com/cookie-law/browser-settings" target="_blank">adjust your browser settings.</a></p><p>By using our site you accept the terms of our <a href="http://www.civicuk.com/privacy-statement">Privacy Policy</a>.</p>'
      },
      position:CookieControl.POS_TOP,
      style:CookieControl.STYLE_BAR,
      theme:CookieControl.THEME_LIGHT, // light or dark
      /** REST OF THE SCRIPT HERE **/
  });
}

So this will make sure cookie control will not try to run when the site is viewed from google's or any other domain.

I hope this helps.

Kind regards,
Gerasimos

Jeff C.

unread,
Apr 10, 2016, 3:16:36 PM4/10/16
to Cookie Control Support
Thank you Gerasimos. Appreciated
Reply all
Reply to author
Forward
0 new messages