Custom Events

Sending custom events to SiteBehaviour Portal

What Are Custom Events?

Custom events allow you to track specific actions or interactions users perform on your website that are important to your business goals. These actions could be anything from adding an item to the cart, clicking on a specific button, or completing a form. By sending custom events, you can gain more detailed insights into user behaviour and fine-tune your marketing strategies accordingly.

How to Send Custom Events to SiteBehaviour

You can easily send custom events from your website to the SiteBehaviour portal using a simple JavaScript snippet. Follow the instructions below to implement it:

Step-by-Step Guide to Sending Custom Events:

  1. Choose an Event Name:

    • You can name your custom event anything that reflects the action you want to track. For example, if you want to track when a user adds an item to their cart, you might call the event "Add To Cart".

  2. Use the JavaScript Snippet:

    • To send a custom event, use the following JavaScript function:

    window.sbVisitorCustomEvent("Event Name");

    Replace "Event Name" with the name of the custom event you'd like to track.

  3. Example: Add to Cart Event:

    • If you want to track when users add items to their cart, the code would look like this:

    window.sbVisitorCustomEvent("Add To Cart");
  4. Where to Place the Code:

    • This JavaScript snippet should be placed in the section of your website where the event occurs. For example, if you want to track clicks on an "Add to Cart" button, place this snippet within the function that handles the button click event.

Example of Button Click Implementation:

document.getElementById("addToCartButton").addEventListener("click", function() {
   window.sbVisitorCustomEvent("Add To Cart");
});

Why Use Custom Events?

  • Track Specific User Actions: Custom events let you track granular actions that are relevant to your business.

  • Improve Marketing Insights: Understanding exactly what users are doing on your website can help optimize your strategies and better serve your audience.

  • Enhance Reporting: With custom events, you can create more detailed reports in your SiteBehaviour portal, giving you deeper insights into user interactions.

If you have any questions or need assistance, feel free to reach out—we're here to help!

Last updated