Embed a script in 'head' to add widget to knack page

Hi I am looking to add a chat widget and tried several tips from stackoverflow but none worked.

Any idea how I could achieve this?

Aleksandr, I have done it with http://Tawk.to and it's worked great the last year. I highly recommend it.

Hi, everyone! Whery interesting theme! I have the same problem. I want to add front livechat in knack app. Somebody did it?

I was able to install intercom in my app, but I want it to work like a private team chat. Does anyone use it for this purpose? Are you able to choose with who from your team you want to chat?

Hi Tony,

Can you explain what you did?

Anyone get intercom working I have it working but it only works in chrome and removes the code completely in any other browser or mobile device it only works on chrome desktop even Knacks install they use in the builder only works in chrome so it's like a bug or something removing the code... I dunno.. no one is any help

Zendesk chat (formerly Zopim) works just by embedding the widget shortcode in a rich text field.

Hey Greg - did you ever have any luck getting Intercom to load when the user is logged out?

Hello Greg,

Sorry but nothing. I´ve been trying to get it solved by myself but it´s impossible for me. The intercom guys tried to help also but we could not make it to work properly.

The best code is the one that Moisés provided.

I´ll let you know if we figure out something.

Thanks Greg.

Hi NG,

Any chance you were able to resolve the issue of having it display when the user is logged out?


Thanks a lot Moisés for your help.

I´ve been speaking to an intercom guy and he told me to check this:

It sounds like you might want to consider using the Javacript API in this case to boot Intercom, instead of the intercomSettings object.

I might recommend reading this doc here: Integrate Intercom in a single page app

I don´t know if it will help someone. I´ve tried to read it but it´s very technical.


Thanks Moisés,

Yes I´ve changed the API ID for my API ID but I was pointing at the commas "" instead of [ ], ;)

I see. Then what should I do to fix that? That´s the code I pasted from you:

window.intercomSettings = {
  app_id: "API ID",
  email: Knack.user.attributes.values.email.email,
  user_id: Knack.user.id,
  created_at: Date.now(),
  name: (Knack.user.attributes.values.name.first + " " + Knack.user.attributes.values.name.last).replace(/\w\S*/g, function(t){return t.charAt(0).toUpperCase() + t.substr(1).toLowerCase();})

var w=window;
var ic=w.Intercom;
if(typeof ic===“function”){
var d=document;
var i=function(){
var s=d.createElement(‘script’);
s.src=‘https://widget.intercom.io/widget/“API ID”’;

Sorry, not very much a code guy.

I really appreciate your time Moisés. Thank you so much.

Hi Moisés,

I´ve tried changing the '[API ID]' for "API ID". And now when the user is logged in it works but when logged out the app is not working because it shows this error.

Thanks a lot for your awesome help Moisés.

Hello Moisés,

Thanks a lot for the code.

I´ve tried but I get the attached error.

Do you know what this is about?

Thanks a lot for your reply.

not a very active part of the community this area, or so it seems :(

Hello guys,

I´ve been working with the intercom fellows and nothing. We also tried the Lazyload thing but also we could not get it working.

Anyone had any success with it?


Hello everybody,

Nice post. Anyone would know how to integrate the intercom chat inside a Knack app?

Thanks in advance.

Sorry for hijacking this thread, but its the only one covering the issue I have.

I need to load a script after the knack script loads on my page for marketing automation (drop a cookie on the users machine so I can track them) using AgileCRM.

I used Stevan's code, but I need some guidance on some of the parameters. In the custom js console in the knack builder I added:

var s=document.createElement("script");
 _agile.set_account('myapikey', 'my-crm-name'); 

The original tracking code provided is:

<script type="text/javascript" src="https://my-crm-url/stats/min/agile-min.js"> </script> <script type="text/javascript" > _agile.set_account('my-api-key', 'my-crm-name'); _agile.track_page_view(); _agile_execute_web_rules(); </script>

Where I added _agile.set_email('visitor@youwebsite.com') according to the documentation AgileCRM provides:

This step is not required unless you have a landing form or offer custom login for your application.

I think I cant just add those calls below the code, could someone please confirm?

If the lazyloader method works better, some help on that would also be greatly appreciated.

// the first parameter is an array of files to load.  The second is a function to execute after all the libraries have completed loading.
LazyLoad.js(['https://cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js'], function () {
    alert('All my files have completed loading!');

// load some external CSS files
var css_files = [‘https://cdnjs.cloudflare.com/ajax/libs/1140/2.0/1140.css’, ‘https://cdnjs.cloudflare.com/ajax/libs/SlickNav/1.0.3/slicknav.min.css’];
LazyLoad.css(css_files, function () {
alert(‘All my CSS files have completed loading!’);

not sure where to put what code in this example…

I want to use the “accrue.js” jquery plugin (to calculate and create an amortization schedule).

Can you help me set it up to use the fields in my database, please?