I've installed the module, completed the cookiebot ID but nothing happens, then I've looked in console and I get "Uncaught SyntaxError: Invalid or unexpected token" (on Chrome) and "SyntaxError: '' literal not terminated before end of script" (Firefox) on this line <script> jQuery('script').last().replaceWith('<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-cbid="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" type="text/javascript" async></script>');</script>, the ID is correct but just replaced with X

The website has jQuery Update installed with 1.7 version of jQuery enabled.

Can be some issues regarding the jQuery version ?

Comments

alexberendei created an issue. See original summary.

dmsmidt’s picture

Thanks for filing an issue.

I quickly tried on a D7 website with jQuery 1.7 and I can't reproduce the error.
Could you try with jQuery 1.10 for example?
What is the version of the browsers you used? Are you sure no browser plugin is interfering? Ad blockers are know to break things.

Note that when the console is open that JS line might not execute correctly due to timing errors.
Did you try this in production? Otherwise, did you setup a matching domain or domain alias in the Cookiebot manager?

alexberendei’s picture

Now I've changed the jQuery to version 1.10.2 and I get same errors (browsers: Firefox 61.0.1 (with AdBlocker disabled) and Chromium (without any AdBlocker) 68.0.3440).
The site uses AdvAgg but I've tried even with ?advagg=0 to bypass the adv aggregation. All the code is in production.

dmsmidt’s picture

Thanks for your PM, I checked your site.
It seems you have a parsing error because we have a closing </script>tag.
We haven't seen that before, but seems legit in certain scenarios.

Could you try if removing that closing script tag on line 94 of the module source code works for you?
See: https://cgit.drupalcode.org/cookiebot/tree/cookiebot.module?h=7.x-1.x#n94

alexberendei’s picture

Thank you, indeed it worked without the closing script tag. Can be normal behavior ?

dmsmidt’s picture

Assigned: Unassigned » dmsmidt

Cool, we will see if this gives any regression, and if not we will add it to the next release.

dmsmidt’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

firewaller’s picture

This fix is not in latest dev version for me. Still getting same error.

dmsmidt’s picture

My bad, seems this never got commited. I've rolled a new release.