Integrating Zoho with Turbolinks

Integrating Zoho with Turbolinks

Hi there, I'm trying to integrate Zoho SalesIQ with TurboLinks and could do with some help. 

Turbolinks means that instead of loading a new page, sections of the html are just update, giving you a SPA looks and feel. The problem is that means the zoho script doesn't reload.

Theoretically, you should be able to move the code snippet to inside an event listener which is triggered when someone follows a link. But that doesn't work (it think due to the fact that the script needs access to the DOM). Any advice?

  1. document.addEventListener('turbolinks:load', event => {
  2. var $zoho=$zoho || {};$zoho.salesiq = $zoho.salesiq ||{widgetcode:"e4e911729aeb93f576887a38a60bcc164dca5ecaeac3183849696e8dfe94206d62d20b68642a16c6f30a825097b333c1", values:{},ready:function(){}};
  3. var d=document;s=d.createElement("script");s.type="text/javascript";s.id="zsiqscript";s.defer=true;
  4. s.src="https://salesiq.zoho.com/widget";t=d.getElementsByTagName("script")[0];t.parentNode.insertBefore(s,t);d.write("<div id='zsiqwidget'></div>");
  5. });


Gives the error ReferenceError: $zoho is not defined at widget:1
    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方