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.

Reply 1 (1)

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!