Solved

Embedding JavaScript code

  • 12 May 2022
  • 1 reply
  • 54 views

Hi there, 

I have a piece of javascript code that I want to embed on a few pages of our community to enable some in-site messaging, does anyone know how I can add the code? 

Thanks!

icon

Best answer by SmartlyGreg 13 May 2022, 04:06

View original

1 reply

Badge

@ruth.kenrick you’ll need to go to Control and then select Customization and finally Third Party Scripts.

From there you can choose where to add the code in relation to the Head and body of the page, unless you’re referring to some tracking code that goes in the very top area “Insert in <HEAD>” the head, then most likely you’ll want the last area or “Before </Body>” before the body closing tag.

If you’re really not familiar with what you are doing I would recommend double checking the code with a third party to ensure you’re not adding anything that shouldn’t be there.

Additionally you can customise what pages the code applies to if not to all pages by wrapping the code in something like this:

<script>
if (inSidedData.page.url.includes("/search?")) {
YOUR CODE GOES HERE
}
</script>

The above example limits the code in it to applying only on the search page.

Hope this helps!

Reply