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! 

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation
                                              • 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!


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now