Track cart adds with Oracle Infinity on Web

Introduction

This tutorial will demonstrate how to track additions to a user’s cart on your website using Oracle Infinity with the Oracle CX Tag by adding tracking to your cart add actions on your website.

Objectives

The objectives of the tutorial are to:

Prerequisites

Please see below for the prerequisites for this tutorial:

Create a Tag (for your Oracle CX Tag)

You must have created and configured a tag for your website:

Already have an Oracle CX Tag on your website?

If you have already created a tag which is in use on your website, you don’t need to create a new specific one for this use case. You must make sure that either (a) the existing tag has already been implemented on the required page(s), or (b) you must create a new tag and implement this on the required page(s).

Step 1: Implement the Oracle CX Tag on your page(s)

If you haven’t already implemented the CX Tag on your desired page(s), you will need to add this to the page(s) in order to load the CX Tag Library so that you can initiate tracking requests to Oracle Infinity.

  1. You should have a Tag URL as per the prerequisites which will use the following format:

    //c.oracleinfinity.io/acs/account/{YOUR_ACCOUNT_GUID}/js/{YOUR_TAG_ID}/odc.js?_ora.config={_ora.config}

    Account GUID, Tag ID and Config

    {Account GUID} identifies your account. All your tags will use the same account GUID so that all data collected for your account is stored together.

    {Tag ID} allows you to assign access rights to your Oracle Infinity Tags and put them into a hierarchical format.

    {_ora.config} denotes which Environment the tag is pointing towards (for example, analytics:test to allow you to point towards different tag configurations per Environment, for example, Test and Production). Please see Environments for more detail.

  2. Implement the following code block in the <head>* of all pages you will be tracking (replacing {Account GUID}, {Tag ID} and {_ora.config} as per your Tag URL). For example:

    Synchronous Implementation

    <head>
    ...
    <!-- CX Tag - Library Load -->
    <script type="text/JavaScript" src="//c.oracleinfinity.io/acs/account/{Account GUID}/js/{Tag ID}/odc.js?_ora.config={_ora.config}"></script>
    ...
    </head>
    

    Asynchronous Implementation

    	<head>
    	...
    	<script type="text/JavaScript">
    	(function() {
    
    	    var accountGUID = "{Account GUID}";
    	    var tagID = "{Tag ID}";
    	    var config = "{_ora.config}";
    
    	    // DO NOT EDIT BELOW THIS LINE
    	    for(var odc_requested=!1,scripts=document.getElementsByTagName("SCRIPT"),s=0;s<scripts.length;s++)scripts[s].src&&/oracleinfinity.*odc\.\js/.test(scripts[s].src)&&(odc_requested=!0);if(!odc_requested){var sc_scripts=document.getElementsByTagName("script")[0],sc=document.createElement("script");if(sc.async=!0,void 0===config)var config="";config&&(config="?_ora.config="+config),sc.src="//c.oracleinfinity.io/acs/account/"+accountGUID+"/js/"+tagID+"/odc.js"+config,sc_scripts.parentNode.insertBefore(sc,sc_scripts)}
    	}());
    	</script>
    	...
    	</head>
    

    *Synchronous or Asynchronous?

    If you are going to be using Oracle Maxymiser then you must implement this in the <head> synchronously as per above to ensure the page content can be manipulated before it is visible to the user. However, if you’re not using Oracle Maxymiser then this can be asynchronous and not necessarily in the <head>.

    If this is not feasible, please see Oracle Maxymiser CX Tag Guidelines or contact Oracle Consulting Services about an engagement to support you with your tagging requirements for an asynchronous implementation.

Step 2: Add a Click Call on your Cart Addition Actions

Available Parameters

Choosing your Parameters: Please see Choosing your Parameters for guidance on selecting which parameters you would like to send:

You must decide which Parameters you wish to send to Oracle Infinity for cart additions.

Below is a table of the available parameters you can send on cart additions:

Available cart addition-related parameters

Parameter Parameter Name Required Sample Value Notes
wt.tx_e E-Commerce Action Required a Preset Value
wt.currency Currency Required GBP Currency Code
wt.tx_s Product Line Item Price Required 20.00 ’;’ delimited list per line item (Product Quantity * Product Unit Price)
wt.product_price Product Unit Price Required 10.00 ’;’ delimited list per product (by line item)
wt.tx_u Product Units Required 2 ’;’ delimited list (by line item)
wt.pn_sku Product SKU Required* SKU1 ’;’ delimited list (by line item)
wt.cg_n Content Group Recommended accessories ’;’ delimited list (by line item)
wt.cg_s Content Sub Group Recommended shoes ’;’ delimited list (by line item)
wt.si_p Step Name Recommended Basket Add Name of step in your funnel
wt.si_x Step Number Recommended 2 Step in your funnel
wt.si_n Scenario Name Recommended Basket Funnel Name of your funnel
wt.pn_id Product ID Optional* 232432 ’;’ delimited list (by line item)
wt.product_name Product Name Optional big trainers ’;’ delimited list (by line item)
wt.product_discount Product Discount Optional 0.00 ’;’ delimited list per product (by line item)
wt.pn_ma Product Brand Optional acme ’;’ delimited list (by line item)

*Product SKU or Product ID?

Product SKU (wt.pn_sku) is the standard required parameter for declaring your products in Oracle Infinity. You can optionally also declare Product ID (wt.pn_id) in your implementation if you wish (you may also skip Product SKU but this will mean some features within Oracle Infinity are not available without customised workflow).

Firing Your Click Call

Once you have chosen your Parameters you must declare them by triggering the following JavaScript function when a user adds any items to their cart:

Sample Click Call Implementation

(function(){
 
    // Declare Your Parameters
    var cxDataObject = {};
    cxDataObject["wt.tx_e"] = "a"; // Transaction Event - Purchase
    cxDataObject["wt.currency"] = "GBP"; // Currency
    cxDataObject["wt.pn_sku"] = "SKU1;SKU2"; // Product SKUs (‘;’ delimited list - by line item)
    cxDataObject["wt.product_price"] = "20.00"; // Product Price (‘;’ delimited list - by line item)
    cxDataObject["wt.tx_u"] = "2	"; // Units (‘;’ delimited list - by line item)
    cxDataObject["wt.tx_s"] = "40.00"; // Transaction Subtotal (‘;’ delimited list per line item (Product Quantity * Product Unit Price))
    cxDataObject["wt.cg_n"] = "accessories"; // Content Group (‘;’ delimited list per line item)
    cxDataObject["wt.cg_s"] = "shoes"; // Content Sub Group (‘;’ delimited list per line item)
    
    // DO NOT EDIT BELOW THIS LINE - ORA.click()
    window.ORA = window.ORA || {productReady: []};
    ORA.productReady.push(['analytics', function(cxDataObject) {return function() {return ORA.click({"data": cxDataObject})}}(cxDataObject)]);
})();

Choosing your Parameters?

Within Available Parameters you may see Required against various parameters. Ideally, you would surface all available parameters, but if you have concerns over supporting maximum request lengths in older browsers (for example, Internet Explorer), then you may use this to help you prioritise which parameters you should implement:

What? Description
Required Typically required for core functionality for Oracle Infinity and connected CX products
Recommended Typically required for recommended functionality for Oracle Infinity and connected CX products
Optional Typically required for optional functionality for Oracle Infinity and connected CX products

Test your Page is Sending Data

Once the Oracle Infinity tracking has been added upon all cart additions, you can validate the request by opening the Chrome DevTools Network Debugger:

  1. Open the Chrome DevTools Network Debugger.
  2. Perform a cart addition (for example, by clicking on an add to cart button).
  3. Filter by dcs in the debugger.
  4. Select the dcs.gif request (this is the Oracle Infinity data collection call).
  5. View the parameters being sent.

Viewing your Oracle Infinity data collection call

Viewing your Oracle Infinity data collection call

Step 3: Check Oracle Infinity is Receiving Data

You can now Check available data within Oracle Infinity for your purchase data as per the Parameters defined within your Click Call above (for example, data.wt.tx_e=a).

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.