Tracking events using Sitecore Discover runtime JS

Note

Integration using Sitecore Discover runtime JS is deprecated.

We recommend that you use the Discover JS SDK to integrate your website or the Discover API for a website or application integration.

If you have integrated using Sitecore Discover runtime JS, all widget events and page view events are streamed to Discover automatically. However, you must still manually send add to cart, cart status, order, and user login events using the rfk.push() function, which is available through the Discover beacon.

The format to send events using rfk.push() is as follows:

RequestResponse
window.rfk = window.rfk || [];
rfk.push(["trackEvent", {<event object>}, <settings>]);

In this code, "trackEvent" is a constant string. The event object consists of key-value pairs representing the event.

Tip

We recommend that you use the Event Builder to learn or validate your event format, then use Event Monitor to verify the implementation of your funnel events.

Example: Tracking an add to cart event

When a user adds an item to their cart, you must send an add to cart event to Discover using the rfk.push() function. The following code sample shows how to send an add to cart event that takes place on a product detail page:

RequestResponse
rfk.push(["trackEvent", 
  {
    "value": {        
      "products": [            
        {                
          "sku""3x112f92d16",                
          "quantity"1,                
          "price"9.99,                          
        }        
      ]    
    },    
    "type""a2c",    
    "name""pdp"
  }]);

Do you have some feedback for us?

If you have suggestions for improving this article,