Finsweet Cookies - Pop Up

Hey! So I’m using finsweet cookies consent tool, but I’m running into an “issue” which I can’t figure out myself, so I’d appreciate some help…

The finsweet cookies consent is working fine, the problem is with the pop up I’ve created on the restaurant page, it shows up once you accept the cookies, but reappears as soon as you refresh the page, but only after the first refresh.

So I’m just thinking out loud; I’ve got no real custom code experience, but I think it might have something to do with the fact that you get the cookie for the pop up and the cookie consent clears the cookies once accepted or something, but yea please help I’m really confused…

<!-- Pop Ups Cookie -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.2.1/js.cookie.min.js"></script>
<script type="fs-cc" fs-cc-categories="marketing">
$(document).ready(function(){
if (!Cookies.get('alert')) { 
$('.pop-up-wrapper').css('display','flex'); 
Cookies.set('alert', true, { expires: 1 });}});
</script>

Thanks in advance!

With kind regards,
Tim Sijtema


https://preview.webflow.com/preview/dockfec?utm_medium=preview_link&utm_source=designer&utm_content=dockfec&preview=d55716f532dda39e25a5fcd88bb87889&pageId=61d82bf7a0c3416551b0f10d&workflow=preview

Bumping this thread , I’d really like to move on with the next thing and fix this thing… It’s driving me nuts. So if anybody is willing to help me it would be appreciated.

If you need any info, just reply on this thread.

Thanks in advance!

With kind regards,
Tim Sijtema

So I tried to diagnose your issue and this one also took a good time for me. Again few things got me confusing because even on this one you’ve 2 similar library included.

Please check the image

And this is the first time I’m checking Finsweet library and I don’t think you need to write extra custom code to implement cookie system. Their JS have probably everything for that and they have made it so simple that you only have to use their specific attributes. It’s written on their document as well. But of course you can use custom JS, if you are sure what you are doing.

And your extra code is the reason for that popup because it is creating another cookie service.

<script type="fs-cc" fs-cc-categories="marketing">
$(document).ready(function(){
if (!Cookies.get('alert')) { 
$('.pop-up-wrapper').css('display','flex'); 
Cookies.set('alert', true, { expires: 1 });}});
</script>

In the code above you are creating another cookie with name alert, which is making your .pop-up-wrapper block popup when alert cookie is not found. And it is only working on second load because you’ve applied type=“fs-cc” on that script. This tag is coming from finsweet and this tag prevents the script load until the cookie content is accepted.

That is why after you accept the first cookie content, on another load your second cookie consent is coming to work.

By the way, I’m not sure what are you trying to achieve here. But if my explanation above clarifies to understand what is happening then I guess you can move forward with it.

@abirana Well what I’m trying to achieve is that my pop up only pops up once every 6 hours and right now everything is working except for the fact that it pops up twice. Once when you accept the cookies and the second time when you reload or go to the next page.

That second pop up shouldn’t happen and I don’t know how to fix that. The scripts aren’t the same even though they are both for cookies.

Finsweets cookie consent only does the consent part and doesn’t have any options to set different cookies to use for pop ups or anything like that.

This shows the problem I’m having. That second pop-up with mini jump is the one that shouldn’t be there or atleast not untill I clear my cookies or wait for 6 hours.

For this popup to work, remove type=“fc-cc” from that script and try.

That didn’t fix it. That only made it so the first pop up comes on the same time as the cookie consent pop up instead of after you click accept.

Ok now, I got some idea about what you want. So let’s try to make it more clear,

First popup should work as it is and second popup should appear after user accepts the first cookie content, right after clicking accept?

Or

First popup should work as it is and second popup should appear after user accepts the first cookie content but only on the next load?

Let me know and I’ll try to come up with a solution.

Hey @abirana so I have two pop ups:

  • The pop up on the bottom-right is the cookie consent pop up and should work as it is.

  • The pop up centered in the middle with mini jump, a picture and some text is the dynamic marketing pop up. The marketing pop up should appear after user accepts the first cookie content, right after clicking accept.

After they click close “X” on that marketing pop up it shoudn’t re-appear with page load or anything unless they wait for 6 hours or unless they remove their cookies.

Hope this makes things more clear. :grinning:

Thanks in advance!

With kind regards,
Tim Sijtema

1 Like

Right now I cannot test this, so I want you to test some code and see if it works.

First try this one, it’s same code without document.ready

<script type="fs-cc">
    if (!Cookies.get('alert')) { 
        $('.pop-up-wrapper').css('display','flex');
        Cookies.set('alert', true, { expires: 1 });
    };
</script>

And I want you to try this one if above didn’t work. type=“fs-cc” is only on the second script here.

<script>
    $(document).ready(function() {
        if (Cookies.get('fs-cc')) { 
            if (Cookies.get('alert')) { 
                $('.pop-up-wrapper').css('display','none'); 
            } else {
                $('.pop-up-wrapper').css('display','flex');
                Cookies.set('alert', true, { expires: 1 });
            }
        }
    });
</script>

<script type="fs-cc">
    $('.pop-up-wrapper').css('display','flex');
</script>

I hope this works, I haven’t tested these so please try and let me know.

Hey @abirana unfortunately these did not help.

  • First code without document.ready changed nothing to the pop-up.
  • Second code made it pop up with every page load and pop up after user accepts the first cookie content, right after clicking accept.

Ok then I’m not sure of the solution here.

If I got time I’ll try to test it again.

Hey, so this still hasn’t been solved… I also noticed the stickers on for example the Pagina Niet Gevonden | DOCK Family Entertainment Center 404 page all show up at the same time in the top right corner. I’ve checked and it doesn’t do that without the finsweet cookies script… The sticker code however doesn’t use any cookies…

Please somebody help me, because if I can’t fix this I’m gonna have to remove the whole cookies script and the only alternative I’ve found is a paid option… Which really isn’t ideal.