Knowledge Base

Using the "Merge" option for Listener rules in BlueConic

Merge rules and listeners

How do I use the Merge option in a BlueConic listener for marketing data collection?

For each BlueConic Listener rule, you can select whether the value will be added, set to a value, or merged (click the first word of a rule). The "merge' option can be very useful when for example you want to accumulate the number of ordered products or the order amount for visitors into a single profile property. The merge option works like this:

  • If the value is a number and the new value is a non-number, the profile value is not modified. For example, if the current value is "1" and the new value is "A", the value remains "1".
  • If the value is a number and the new value is also a number, the two values will be added together. For example, if the current value is "1" and the new value is "2", then the value becomes "3".
  • If the value is a non-number and the new value is also a non-number, then the two values will be concatenated. For example if the current value is "A" and the new value is "B", then the value becomes "AB".
  • If the value is a non-number and the new value is a number, the two values will be concatenated. For example if the current value is "A" and the new value is "1", the value becomes "A1".

Using the "clickContext" object for defining a custom value Selector

By default, Behavior Listening searches for the first HTML element in the page that matches the Selector and retrieves the text this element contains as the value to write to the profile. There are times, however, when you want to retrieve the value from an element that is relative to the element the visitor clicked. For example, if there are several products present on a page and you want to store in the profile the name of the product the visitor clicked. In this situation, you need to search for a specific HTML element in the area surrounding the HTML element that was clicked.

For example, let's say you have the following HTML on a page:

<div class="product">
  <div class="product-name">Bose Wave Radio</div>
  <a href="#">More Info</a>
</div>


When the user clicks the "More Info" link, you want to store the value of the "product-name" div. By entering the following JavaScript statement in the Custom value selector field, you can store the name of the specific product that the user clicked in their profile:

jQuery(clickContext).parent().find('.product-name')

 How do I use JavaScript to add a merge option to a BlueConic listener?

Was this article helpful?
0 out of 0 found this helpful