How can I include custom JavaScript on policy pages?

How can I include custom JavaScript on policy pages?

bensauer
Shopify Partner
1 0 0

Hello,

we are using a Cookie Banner Provider which has the functionality to print all used cookies on the privacy policy page automatically. We just need to include the Cookie Banner Providers SDK (included in the theme via <script> tag) and create a <div> with a special id at the place where all used cookies should be rendered.

-> noting fancy here, industry standard.

On the normal policy page which uses the content from /admin/settings/legal everything works fine.

But in the checkout the legal pages in the footer are not normal links but buttons which open the pages in a modal window.

Now the Problem is that the content of the modal is an iframe with only the legal text as its content (it loads /xxxxxxx/policies/privacy-policy.html and not /policies/privacy-policy). So our Cookie Banner Provider JavaScript SDK is not included in this iframe and so the used cookie overview is not rendered.


Adding the script in the textarea at /admin/settings/legal does not work because script tags will be filtered out.


Is there a way to include custom JS there? Or is there an option to use normal links instead of the modal/iframe solution? (beside writing some custom js for the checkout, which is possible because we are using Shopify plus)

Thanks for your help.

Replies 2 (2)

lena_artdeco
Visitor
1 0 0

Hi @bensauer 

we are actually having a similar issue as you had back then. We need to add a custom script that our Cookie Banner Provider shared with us, to exclude the Cookie banner on the policy pages. Have you found any workaround for this issue? 

 

Thanks!

 

janjan
Not applicable
1 0 0

Same issue here, changes my cookiebot code to:

<a data-encoded-tag-name="script" data-encoded-tag-value="" data-encoded-attr-id="Q29va2llRGVjbGFyYXRpb24=" data-encoded-attr-src="aHR0cHMlM0ElMkYlMkZjb25zZW50LmNvb2tpZWJvdC5jb20lMkZkNTQ5NmRlNi1iZjZlLTRjNGMtOWIxZC04ZmUxZDU3NTMxODYlMkZjZC5qcw==" data-encoded-attr-type="dGV4dCUyRmphdmFzY3JpcHQ=" data-encoded-attr-async=""></a>

 

How can we disable this?