Replies: 8 comments 5 replies
-
Hi @csaeum, in v2 your setup was something like this: var cc = initCookieConsent();
// `cc` is now a global alias (can be used in all script tags): you can use `cc.something()`
cc.run({...}): There are multiple ways to achieve this in v3. The simplest one is to load the import 'https://cdn.jsdelivr.net/gh/orestbida/[email protected]/dist/cookieconsent.umd.js';
// global (default) alias `CookieConsent` available: you can use `CookieConsent.something()` in all script tags
CookieConsent.run({...}) you could also keep using the import 'https://cdn.jsdelivr.net/gh/orestbida/[email protected]/dist/cookieconsent.umd.js';
// global (default) alias `CookieConsent` available: you can use `CookieConsent.something()` in all script tags
// create new global alias, `cc`: you can use `cc.something()` in all scripts
window.cc = CookieConsent;
cc.run({...}) Here is the same behavior using the import * as CookieConsent from 'https://cdn.jsdelivr.net/gh/orestbida/[email protected]/dist/cookieconsent.esm.js';
// create "global alias", so that you use `cc.something()` in all scripts
window.cc = CookieConsent;
cc.run({...}) I will probably change the playground's config. file so that it uses the |
Beta Was this translation helpful? Give feedback.
-
Thanks @orestbida I got further and the scripts are now loaded but unfortunately what is in "function.tpl" doesn't work. I have now inserted the content as a SCRIPT tag in front of the DataLayer in the page. You can also watch it live on the website https://sw5.dev.web-seo-consulting.eu. As I said, it doesn't work the way I want it to, but I'm just trying to figure out why it's not in the functions Here The Functions
Here the Content for my "orestbida-cookieconsent-function.tpl"
Thank you for your patience and information |
Beta Was this translation helpful? Give feedback.
-
Here is my Shopware 5 plugin with the code I showed here |
Beta Was this translation helpful? Give feedback.
-
Found the issue! A script tag with the You can fix this by loading the plugin the traditional way (not deferred): <script src="https://cdn.jsdelivr.net/gh/orestbida/[email protected]/dist/cookieconsent.umd.js"></script>
<script>
window.cc = CookieConsent;
cc.run({...});
</script> Make sure you remove the "import" line: Ideally speaking, you should defer all non-critical script tags (cookieconsent and all related scripts) so that your page is loaded quicker. I noticed you've created services (matomo, youtube ...) as if they were categories, there is an easy way to configure them properly as services: |
Beta Was this translation helpful? Give feedback.
-
Yes, I understand the categories and services. But with the services I can't deselect them individually, can I? Because that's what our data protection officer wants, that visitors can really switch off the "cookies" individually |
Beta Was this translation helpful? Give feedback.
-
@orestbida I don't know where my head is right now. Now it is displayed correctly for me. Even when accepting, the PUSH arrives in the data layer from the "orestbida-cookieconsent-function.tpl". The GTAG Manager shows me this. But as soon as I call up another page, the PUSH in the data layer no longer arrives and the GTAG Manager can therefore not fire. As I said, everything is great with the V2, but the V3 is not making it easy for me. Would be grateful again for tips. I'm happy to upload the changes for you as soon as I'm home. Because at work I can't make the STAGE environment public. |
Beta Was this translation helpful? Give feedback.
-
So I have to ask again. I have now switched everything to services, which makes it clearer for the visitor. Unfortunately I still have the problem that I am asked for the consent when entering the site. But as soon as I click on a link the consent doesn't seem to be passed on. So the OnFirst or Accept is sent and the Google Tag Manager and Matomo Tag Manager run after "Accept all" but as soon as you call up the next page, nothing happens again. Hope someone can tell me what's going on. Here is my test environment: https://sw5.dev.web-seo-consulting.eu/ |
Beta Was this translation helpful? Give feedback.
-
Hello and thank you @orestbida I installed the other services first, but it didn't work with the push into the data layer.
Then I installed it in the scripts of the tag manager, now everything works.
One last question is still open. The one here in the playground is not yet output in the config that can be downloaded. I searched the JS file and found this. But doesn't seem to work.
But they don't work in v3.0.0-rc.16 |
Beta Was this translation helpful? Give feedback.
-
Hello community
I'm not a very good developer and am trying to transfer my installation from V2 to V3.
The consent is displayed to me and partly also reacts.
Maybe some will laugh but right now I'm stuck here:
If I run the scripts with e.g.:
then it works and I see this in the GTAGManager
but when I call the functions like here I get the message in the browser.
I stick very strictly to the documentation
Here is the content of what I called "function.tpl"
I integrate these into the actions such as onConsent etc.
hope you can tell me where my mistake is. Unfortunately, JS is not my friend yet. But I would appreciate tips
Beta Was this translation helpful? Give feedback.
All reactions