The following are some key things to note about the Search Javascript event:
- This event would trigger right as a person searches or finishes searching on your site.
- This enables the Search Abandon campaign and is also good text analysis on Users for determining their interests.
- Key differences for this wave:
- The 'setAction' sets an event of 'search'
- You are going to grab the value from the search bar and pass it as the 'search_term' as a string.
Search event details
The search event is used for collecting the search terms that a user has searched for.
/*** EVENT SPECIFIC CODE ***/
_rsq.push(['_setAction', 'search']);
_rsq.push(['_setParams', {'term': 'search_term'}]); // replace search_term with your dynamic search_term variable
/*** END EVENT SPECIFIC CODE ***/
Search event code sample
<!-- RetentionScience start -->
<script type='text/javascript'>
var _rsq = _rsq || [];
_rsq.push(['_setSiteId', 'site_id']); // replace site_id with your static Site ID
_rsq.push(['_enableOnsite']);
if (condition) { // replace condition with your parameters for checking if a user is logged in
_rsq.push(['_setUserId', 'user_id']); // replace user_id with your dynamic user_id variable
_rsq.push(['_setUserEmail','user_email']); // replace user_email with your dynamic user_email variable
}
/*** EVENT SPECIFIC CODE ***/
_rsq.push(['_setAction', 'search']);
_rsq.push(['_setParams', {'term': 'search_term'}]); // replace search_term with your dynamic search_term variable
/*** END EVENT SPECIFIC CODE ***/
_rsq.push(['_track']);
(function() {
var rScix = document.createElement('script');
rScix.type = 'text/javascript';
rScix.async = true;
rScix.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'd1stxfv94hrhia.cloudfront.net/waves/v3/w.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(rScix);
})();
</script>
<!-- RetentionScience end -->
Comments
0 comments
Please sign in to leave a comment.