cancel
Showing results for 
Search instead for 
Did you mean: 

Embedding a gamification script on CMS page

Embedding a gamification script on CMS page

Hi 

 

I am not a developers, but my developers are facing issues embedding a script on a single CMS page. 

The script is for gamification and is suppossed to show a "Choose the right pillow test" 

 

<script id="_ss_11467">
(function(w,d,s,l,r,a,m){
if(d.getElementById(r))return;
w[r]=w[r]||{};a=d.createElement(s),m=d.getElementsByTagName(s)[0];
a.async=1;a.src=l;a.id=r;m.parentNode.insertBefore(a,m);
})(window,document,'script','https://cdn.scratcher.io/embed/11467.js','Scratcher_11467');
Scratcher_11467.options = {
slug: 'vaelg-den-rette-hovedpude-for-dig',
width: '100%',
height: 1100,
};
</script>

 

It does not work. I believe the script is supposed to be on the body of the CMS page. Any guidance? 

 

Thanks

2 REPLIES 2

Re: Embedding a gamification script on CMS page

@basti_sørensen 

Add your custom JS to Admin > Content > Elements > Pages > CMS Page > Design > Layout Update XML as shown below:
<head>
<script src="Vendor_Extension::js/custom.js"/>
</head>
Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: Embedding a gamification script on CMS page

I think the problem lies in the path https://cdn.scratcher.io/embed/11467.js
You should download the JS files and put them in the web/js of theme
Then change the http path to the filename

LitExtension - #1 Shopping Cart Migration Expert

LitExtension helps store owners and agencies migrate all important data from one eCommerce platform to another accurately, securely and at the highest speed.

Visit website: http://litextension.com/