How can i insert a JS-Code on my Page

Hey, how can I add a JS code for an optin field to my page? Sorry, but I’m not the biggest technician.

Hello Marc,

Thanks for asking. :slight_smile:

To add JS code to a page, you can take a look at following thread.

Thanks.

Sorry, but I think you did not understand that. I would like to insert an optin form on my landing page. I already have a header / footer manager. Thanks; o)

Hi again,

To insert a JS code to a page, edit your page in Cornerstone then add your script in Cornerstone’s JS section (see screenshot)

Make sure you don’t include the <script></script> tags in the code. Hope this helps!

No it’s not working.

This is the code to insert.

<script type="text/javascript" src="https://app.getresponse.com/view_webform_v2.js?u=Srsk&webforms_id=SQmP1"></script>

BUT there is no “>” after the first “<script”

I put it in the JS section as you wrote and now?
where and how can I place it on my side so that the optin field is visible

Hi again,

So basically you’ve a script source. To include that in your site, add the following code in your child theme’s functions.php file:

function my_custom_script(){
	?>
		<script type="text/javascript" src="https://app.getresponse.com/view_webform_v2.js?u=Srsk&webforms_id=SQmP1"></script>
	<?php
}

add_action( 'wp_footer', 'my_custom_script', 10 );

Let us know how this goes!

No, is not working. or am I doing something wrong?

Hi Marc,

The code provided by Nabeel works, I’ve tested it. But since that is a form, yes you need that to be on the content.

Please paste your code on a Content Area element.

`

`

I’ve tested that on my dev and it works, it won’t show a preview in Cornerstone, but it will render on the front end.

if it does not work on your end, please do a test for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

Cheers!

ok, did I understand that correctly? I’ll just pack the code into a content area element and then it will work for you. Right? I do not have to enter any additional code. Right?
If it does not work then it’s because of a plugin. Right?

Because it does not work if I just put the code in a content area element. I’ve just tried that.

Yes, that is correct:



If it does not work on your end, likely there is a plugin or another script that causing a conflict.

If you have a caching plugin, please clear it as well.

Thanks,

ok, i will test it tomorrow. Now I have to sleep. :wink:

I have now disabled ALL plugins except for Cornerstone. The result … it does not work! :frowning:
I also emptied the cache.
Maybe you have an idea.

But now I’m really going to bed.

Hi Marc,

If you’re still up, please provide us the site URL and a login credential in a secure note so we can take a closer look while you’re sleeping.

Have a good night,

Hi Marc,

It looks like your site has security that blocks the loading of any URL not related to your site. There is 100 errors related to that and displayed on browser console.

VM2106:1 A parser-blocking, cross site (i.e. different eTLD+1) script, https://app.getresponse.com/view_webform_v2.js?u=Srsk&webforms_id=SQmP1, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.

Perhaps it’s your hosting security? Especially if you’re in country with strict law about privacy? I tried it outside the builder and the theme and it’s still the same, the code won’t work since it’s blocked. I recommend contacting your hosting provider.

Thanks!

Ok, i will contact my provider.
First of all thank you for your help :frowning:

Let us know how it goes!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.