Activate on satisfying a condition question

Activate on satisfying a condition question

Hi, 

I'd like to use the "Activate on satisfying a condition" option of the "Experiment Activation Mode"..

I created this condition: 

document.querySelector("div.location-top-data a.btn.blue.radius.xsmall").innerHTML == "Contact Us";

The idea is that the experiment only runs when this condition is satisfied. 

Question: the website contains pages where this same element div.location-top-data a.btn.blue.radius.xsmall is not there. Testing the script on these pages, at Chrome console, I receive this message: 

Uncaught TypeError: Cannot read property 'innerHTML' of null at <anonymous>:1:73

Is it OK that this script return this or must return "false"? Wondering if that could potentially cause any issues at pages where the element is not there. 

Thanks! 

    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      • Sticky Posts

      • CSS not loading in heat map view

        I ran into a problem with two different websites where when I view the heat map experiment, the CSS for the page is not loaded under the heat map overlay. When going to the page directly, everything looks fine. The page also looks right on the Experiments page where a screenshot is used as the thumbnail... The sites are both WordPress websites. I've tried both the regular snippet and async. I'm hoping this has been seen before and there's a solution. Thanks!

      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 コンテンツ




                              ご検討中の方