Track purchases with Oracle Infinity on web

Introduction

This tutorial will demonstrate how to track purchases on your website using Oracle Infinity with the Oracle CX Tag by adding tracking to your order confirmation page.

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 View Call on your Order Confirmation Page

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 all purchases.

Below is a table of the available parameters you can send on your order confirmation page to track purchases.

Available purchase-related parameters

Parameter Parameter Name Required Sample Value Notes
wt.tx_e E-Commerce Action Required p Preset Value
wt.tx_id Invoice Date Required 12/25/2021 mm/dd/yyyy
wt.tx_it Invoice Time Required 23:58:10 hh:mm:ss
wt.tx_i Invoice Number Required 132432ASP34 Invoice/Order ID
wt.currency Currency Required GBP Currency Code
wt.cart_subtotal Cart Subtotal Required 105.00 Cart value (minus tax + shipping)
wt.cart_total Cart Total Required 116.00 Cart value (inc tax & shipping)
wt.pn_sku Product SKU Required* SKU1;SKU3;SKU9 ’;’ delimited list (by line item)
wt.tx_s Product Line Item Price Required 10.00;80.00;15.00 ’;’ delimited list per line item (Product Quantity * Product Unit Price)
wt.product_price Product Unit Price Required 10.00;20.00;5.00 ’;’ delimited list per product (by line item)
wt.tx_u Product Units Required 1;4;3 ’;’ delimited list (by line item)
wt.cg_n Content Group Recommended accessories;womens;accessories ’;’ delimited list (by line item)
wt.cg_s Content Sub Group Recommended shoes;dresses;socks ’;’ delimited list (by line item)
wt.product_coupon Product Coupon Recommended SPRINGDISCOUNT Discount Code
wt.cart_tax Cart Tax Recommended 10.00 Cart tax
wt.cart_shipping Cart Shipping Recommended 1.00 Shipping costs
wt.cart_discount Cart Discount Recommended 4.00 Any discounts applied
wt.si_p Step Name Recommended Order Confirmation Name of step in your funnel
wt.si_x Step Number Recommended 5 Step in your funnel
wt.si_n Scenario Name Recommended Basket Funnel Name of your funnel
wt.conv Conversion Name Recommended 1 Set to ‘1’
wt.pn_id Product ID Optional 232432;23423;32123 ’;’ delimited list (by line item)
wt.product_name Product Name Optional big trainers;big dress;stripey socks ’;’ delimited list (by line item)
wt.pn_ma Product Brand Optional acme;fudd;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 View Call

Once you have chosen your Parameters you must declare them by implementing the following code block within the <body> of your order confirmation page:

Sample View Call Implementation

<body>
...
<script type="text/JavaScript">
(function(){
 
    // Declare Your Parameters
    var cxDataObject = {};
    cxDataObject["wt.tx_e"] = "p"; // Transaction Event - Purchase
    cxDataObject["wt.tx_id"] = "12/25/2021"; // Transaction Date
    cxDataObject["wt.tx_it"] = "23:58:10"; // Transaction Time
    cxDataObject["wt.tx_i"] = "132432ASP34"; // Transaction ID
    cxDataObject["wt.currency"] = "GBP"; // Currency
    cxDataObject["wt.cart_subtotal"] = "105.00"; // Cart Subtotal
    cxDataObject["wt.cart_total"] = "116.00"; // Cart Total       
    cxDataObject["wt.pn_sku"] = "SKU1;SKU3;SKU9"; // Product SKUs (';' delimited list - by line item)
    cxDataObject["wt.product_price"] = "10.00;20.00;5.00"; // Product Price (';' delimited list - by line item)
    cxDataObject["wt.tx_u"] = "1;4;3	"; // Units (';' delimited list - by line item)
    cxDataObject["wt.tx_s"] = "10.00;80.00;15.00"; // Transaction Subtotal (';' delimited list per line item (Product Quantity * Product Unit Price))
    cxDataObject["wt.cg_n"] = "accessories;womens;accessories"; // Content Group (';' delimited list per line item)
    cxDataObject["wt.cg_s"] = "shoes;dresses;socks"; // Content Sub Group (';' delimited list per line item)
 
    // DO NOT EDIT BELOW THIS LINE - ORA.view()
    window.ORA = window.ORA || {productReady: []};
    ORA.productReady.push(['analytics', function(cxDataObject) {return function() {return ORA.view({"data": cxDataObject})}}(cxDataObject)]);
})();
</script>
...
</body>

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

Step 3: Test your Page is Sending Data

Once the Oracle Infinity tracking has been added to the order confirmation page, you can validate the request by opening the Chrome DevTools Network Debugger:

  1. Open the Chrome DevTools Network Debugger.
  2. Refresh the page.
  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 4: 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 View Call above (for example, data.wt.tx_e=p).

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.