Custom Scripts on CLP

Hey folks,

probably anybody has an idea about how to add custom scripts for the landing page…as i’m looking to add one to be able to load a cookie consent banner.

I tried it with two different gems

https://github.com/frizbee/cookieconsent
https://github.com/infinum/cookies_eu

Following all the isntructions the and adding the scripts directly into the custom script editor works fine … but only on homepage level.

For some reason the landing page keeps ignoring the inline javascript. Is this a know issue or does anybody know how to make it working?

I already tried also to add the script directly into the files _head.haml / _head_script.haml / landing_page.erb

Any ideas?

Hey @shoesack!

Hmm, that is strange: the Custom script feature should load smoothly by default. Are you using a very old version of the Custom Landing Page (CLP)? We enabled Custom script in CLP in https://github.com/sharetribe/sharetribe/pull/3035

Would you have a chance to check that you are running that part of the code, too?

Hey @thomasmalbaux,

thanks for the reply. I’m on 10.1.0 so the mentioned PR is already part of the code.

I assume that the landing page i somehow ignoring window.addEventListener("load", function(){.... because the script is rendered in source code but not executed…compared to the homepage (http://lvh.me:5000/s…) where its executed and rendered in frontend without any issue.

Tested in FF and Chrome, getting the same results.

Thats the rendered script in code

This is how it should be rendered (screenshot from homepage/s?..)

Thanks a lot for investigating.

Thanks for the details!

Unfortunately I’m not sure how to explain why that code wouldn’t load on the Custom Landing Page. Hopefully somehow with more technical knowledge will share their insights, or recommend an alternative!

Seems i found the reason … at least parts of it.

For some reason the landing page itself cant access the gems from the main application…therefore it doesnt execute the script as its looking for function which are not defined (the function ar edefined but in the gem directly)

So workaround for this by now is only to add the js function itself but also the execution to the custom script in backend.

Probably somebody can point me to the files, the landing-page is using so i’ll give it a try and create the js functions directly in the code