Triggering Site Intercept based upon an On Click Event
OnCue.$("#lga img").one("click", __ON_TRAIT_MATCH__);
The $(“”) is a jQuery function that lets you look for certain elements within the web page. It is the most used of all jQuery functions and can be quite powerful. I won’t go into a full blow explanation of jQuery selectors but here is a link to the api reference and another to a simple jQuery Primer. The above example is finding the image tag that has and ID of #lga and hooking its “click” event. In this case we are using the Google Logo on the google home page as the example.
You can also define different events other than “click” to trigger a site intercept for your customer experience research. We have only tested the code using “click” but feel free to try to monitor for other events such as mouseover or onkeypress. Just make sure the element you are monitoring uses that event. Here is a list of HTML events.
Here are a few other examples:
OnCue.$("a[title='HIGH PERFORMANCE']").one("click", __ON_TRAIT_MATCH__);
Identifies an anchor tag that has the title HIGH PERFORMANCE. This example was actually a menu item
Identifies an anchor tag with an attribute that had select_brand as the value. This element triggered a drop down and did not navigate between pages.
- If the click event causes a navigation you have to open your research using a “New Browser Window” under the Behavior tab.
- If the click does not cause a navigation you can use an “On Page Dialog” or you can use an Opt-in Dialog but if you choose to use an Opt-in Dialog you need to make it part of the same Sample Group. Rule of thumb is that all traits in a Sample Group must be true for research to be triggered. Two or more Sample Groups are treated as either situations. If one Sample Group is true the research can be triggered.
The Code if you don’t want to copy it from above.
Please direct any questions to OnCue support.