Usually, firing a custom event requires implementing a JS code into your site's code.
However, you can leverage a Dynamic Yield template called "Fire Event" to fire an event without making any code change to your site. Not only that, but you can also limit it with triggers (e.g. hover an element, exit intent) and targeting condition (e.g. user belongs to a specific audience, the user's device is iPhone).
Let's take an example of a custom event you want to trigger every time a particular element is clicked on your site:
- Go to Site Personalization › New Campaign and click Custom Code.
- Specify the campaign settings such as trigger, frequency, and advanced settings. In our example, because we want to trigger an event every time an element is clicked, set the trigger to Advanced and define the trigger as Element Click, and use CSS to define an element on your page.
- Configure the targeting settings of the experience to determine when and where you want the campaign to be. In our example, we will set this to the page or pages that contain the button we are tracking.
- In the variations tab, click New Variation and select the template Fire Event.
- Specify the Event Name. This is the name that will be passed in the event.
- Save the Variation.
- Select a primary metric for the experience.
- Save the Experience and click Next.
- Move the status to Active.
- Save the Experience and Publish the campaign.
Please sign in to leave a comment.