In the previous blog post, we covered a primer on what are Rules in Adobe Launch. We saw how Rules imitate an if…then structure, and how the three main components: Events, Conditions and Actions work. In this blog post, we will cover in depth the different types of Events that are available for us to utilize. Let’s dig in!

What is an Event in Adobe Launch?

As we recall, Events are a way of telling Adobe Launch that a particular user action has been recorded. The action can be loading a page, loading of a media file, a mouse or keyboard click, etc. Adobe Launch categorizes these actions into a bucket called Event Types. And these event types are dependent on the Extension that you select.

Event Types in Core Extension

The Core extension is available out of box when you set up a Launch property. It has multiple event types that cover most of the common implementation scenarios. The available options are categorized in the below groups. There is a great guide available on the Experience League. I highly recommend bookmarking the article for future use.

  • Browser
  • Form
  • Keyboard
  • Media
  • Mobile
  • Mouse
  • Other
  • Page Load

In this article, we will be focusing primarily on the options that I mostly use in my implementation requirements. The most common ones that I have used are available in Other and Page Load category:

Event Category: Other

The different options available in Other bucket are:

Event Type: Custom Code:

For scenarios that don’t fall into any of the available categories, using custom code is a good option. You will need to include the trigger() function to execute the Rule. I have given an example below, but there is another very helpful example available in Adobe Tech Blog

Scenario: Let’s say you want to trigger a rule only when the pageType parameter is available. You can easily do it using the QSP data element, but for now we focus on the Custom Code type. This is how you will add the condition using the Custom Code option:

And when the pageType query string parameter populates, Adobe Launch will trigger the Rule and fire the requested action. But I highly recommend to use the Custom Code method only in exceptional circumstances.

Event Type: Custom Event:

Thanks to Jenn Kunz from digitaldatatactics.com. Her helpful blog cleared my doubts on how to use a Custom Event and attach it to a button click.

Custom Event data types allows Consultants to listen for custom events that a developer might add into the code to capture additional parameters. These parameters can be recorded and passed to Adobe Analytics. Referencing a definition from jimalytics, custom events are a way of forcing an event to trigger using native JavaScript functions. If you are considering using a Direct Call , Custom Events might be a better alternative. They allow passing of custom data layer parameters. But now Direct Call Rules too have a feature to pass addtional info with the _satellite track() method.

Let’s understand Custom Events with an example:

Scenario: On click of an add to cart button, you’d like to pass additional parameters such as name, price and color to Adobe Analytics. You’ll pass below code to the developer to include in the web app:

 <button type = "button" class = "btn btn-primary" id = "cartAddButton">
    Add to Cart!
 </button>

    const addToCartButton = document.querySelector("#cartAddButton");
        addCartButton.addEventListener('click', fireMyEvent, false);
        
        function fireMyEvent(e){
        e.preventDefault();
        let myCustomEvent = new CustomEvent("cartAdd", 
        { detail: 
            { name:"iPhone 13 mini", 
              price:"1000", 
              color:"red" 
            }, 
            bubbles: true, 
            cancelable: true 
        }); 
        e.currentTarget.dispatchEvent(myCustomEvent)
        }

In Adobe Launch you will create a new rule using the Custom Event Event Type and configure it as below.

That’s it. Now whenever a visitor clicks on the Add to Cart button, Adobe Launch will trigger the rule and fire the requested action. Now you can pass the required data with Custom Events and you can create any type of rule and configure condition to pass any level of related data into Adobe Analytics.

The helpful console.log code that I am using to debug what data is being passed on a button click is referenced from: digitaldatatactics.com

    var elem=document.getElementById("cartAddButton")
        elem.addEventListener('cartAdd', function (e) { 
        console.log("'CUSTOM EVENT 'cartAdd' fired with these details:",e.detail)
    }, false);
Event Type: Data Element Change:

This is a self-explanatory event type available for use. From the official definition on Experience League:

“The event triggers if a specified data element changes. Adobe Launch will check a Data Element every second to see if its value has been changed. If it detects, the rule gets triggered”. As per Jim Gordon from jimalytics.com, this event type is best suited for detecting events in single page apps.

Event Type: Direct Call:

Direct Call Rules (DCR) event type is similar to the Custom Event type. This event type was initially in its own category in Adobe DTM. But has now rightly been placed in the Event Type menu. Direct Call Rule is a brute force way of firing an Adobe Launch rule when a developer wants it to. All you need to do is ask the developer to call a _satellite.track() method with the string name in the brackets. Adobe Launch will trigger the appropriate Rule and fire the requested action.

Let’s take the earlier example of passing product level data whenever a visitor clicks on ‘Add to Cart’. But instead of using Custom Event method, we will be using Direct Call method.

As you can see, we are able to achieve exactly the same objective like Custom Event option. This seems like an easy option and is preferred in exceptional cases. But the important part to know is that many developers are wary of injecting _satellite.track(‘string’) function in their code.

Other Event Types:

The other Event Types are self explanatory. I will reference the definiton from the official Experience League guide.

  • Element Exists: This event type will check if the particular element is available at the time of the rule getting triggered
  • Enters Viewport: This event type will trigger a rule when the specified element within the rule exists within the browser viewport
  • History Change: This event type triggers if a pushState or a hashchange event occurs. There are no settings for this event type
  • Time on Page: The Time on Page event type will trigger the rule after a designated period of time after the library loads (measured in seconds)
Event Category: Page Load:

The Page Load events condition trigger, as the name suggest, on the load of the page in the browser. Depending on your objective, you can use either of the options below to fire a Launch Rule. In my experience, Window Loaded is the most used option followed closely by Library Loaded(Page Top). The Window Loaded option helps Adobe Launch wait on other elements such as the Data Layer to be completely built before firing the beacon.

  • DOM Ready The event triggers when the DOM is ready and the user can interact with the page. There are no settings for this event type.

  • Lbrary Loaded (Page Top) The event triggers as soon as the tag library is loaded. There are no settings for this event type.

  • Page Bottom The event triggers once _satellite.pageBottom(); has been called. When loading the tag library asynchronously, this event type should not be used. There are no settings for this event type.

  • Window Loaded The event triggers when onLoad is called by the browser and the page has finished loading. There are no settings for this event type.

That’s all for this edition of the B2B : Adobe Launch Rules : Events topic. Events are the most critical element when building an Adobe Launch Rule. It is thus important to understand the different ways you can use Events to your advantage based on your requirements. We will be diving into Conditions and Actions in the next blog post, and close the B2B : Adobe Launch series.

As always, if you have any queries, comments or suggestions, please drop me a line at ritesh(at)thelearningproject(dot)in. See you in the next update!