Where to place a callback hook for cookie compliance

Hi all,

I could use some guidance for where to add a short .js callback-hook for cookie compliance. I am using Ghost4.0 and Liebling.

There are some very closely related threads, but I have not be able to find any advice for where to add this callback. I am using a popup tool creator by Osano - Cookie Consent, they provide a tool to create a consent button which can be found here: (click start coding on this page).

The advanced option for this button creator includes a script with a callback hook to disable/enable cookies depending on which option is clicked (this page). … I have tried, without success, to inject it into header/footer. but I think it needs to be placed in theme or perhaps the Ghost base? I can do this, but I’m not sure where to place it.

This tool is opensource on github, where they mention:

With version 4.0 you only need to attach the script as we’ve bundled everything together now. The initialization style has changed as have the callbacks (they’re gone). Please see the text below to get started.

…But the github links back to the previously linked script. I am a bit out of my depth, and would greatly appreciate any guidance that you can offer.

About:
I use Ghost blog as an Audio & Visual portfolio, in doing this I embed SoundCloud playlists and YouTube videos (I do use youtube’s Privacy - enhanced modewith nocookie). The SoundCloud embeds result in a cookie sc_anonymous_id being implemented.

|

I’ve read through a bunch of related threads, but wasn’t able to find the info I that I’m looking for. But for anyone else who comes across this, you might be interested:

2 Likes

I’m currently hung up on the same problem. I don’t understand where to add the opt-in/opt-out feature. Also, I don`t understand how to include each cookie to the script… Would love to hear whether you figured it out by now.

I wasn’t able to create my own cookie script. I decided to use CookieYes, and then injected a line into the global site header. It seems to work well, but I do have some questions and would love to implement my own script… CookieYes needs cookies to function (ugh); however, they are at least transparent about this and provide some ability to customize.

[<] script id=“cookieyes” type=“text/javascript” src=“https://cdn-cookieyes.com [redacted client data] script.js”>

Thanks for this! Osano now has the ability to be code injected into Ghost, but Osano scripts break infinite scrolling and dropdown menus on the Casper theme. Have switched to CookieYes based on your thread and infinite scrolling and dropdown menus are working again.

1 Like

Not seeing where/how to update my original post. I came across this post which might have a good solution for Cookie Compliance: https://forum.ghost.org/t/cookie-banner-notification/40782/2; it utilizes this git project.