Like button

Collecting useful information on visitor behavior can be a complex task. But some visitors will just tell you what they like so why not record it!

  1. Create a custom object in Salesforce related to the Lead or Send2CRM Visitor. Add this to the appropriate layout(s) and/or report(s) to expose the information.

  2. Add a button or link to “Like” posts, products and pages on the website. Pick a tag for each that will be useful later, and have this button create a custom Send2CRM event.

    <a class="like-button" data-liketag="MyProduct">Like this</a>
    document.querySelectorAll('a.like-button').foreach(btn => { btn.addEventListener('click', (evt) => { // When the link is clicked, apply a custom event with the tag. send2crm?.analytics?.setCustomEvent('LIKE', { likeTag: btn.dataset.liketag }); }); }
  3. Create an Automation in Salesforce to raise a platform event when the “LIKE” custom event is passed in with visitor updates.

  4. Save the tag values to the new custom object when the platform event is raised. For example, using a Flow that extracts the value from the Send2CRM event data.

For a limited number of tags, Send2CRM Segments could be used instead of a custom event. No need for a custom object and the save is handled automatically!

send2crm?.analytics?.visitor.addSegments(['LIKE_' + btn.dataset.liketag]);

Extended functionality

  • If you want to distinguish previous likes, the Send2CRM personalized data can be used.

<a class="like-button" data-liketag="MyProduct"><span class="liked-text">I </span>Like this</a>
  • Add dislikes as well as likes.

  • Add more information in custom properties of the custom event.