Embedding JavaScript code
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!
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!
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!
If you already have a profile on Gainsight Community or Gainsight University, there's no need to create another one. If your email address has changed or you can't remember your login, email community@gainsight.com. Otherwise, continue with the registration below.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.