Analytics Reporting URL Patterns

Each Analytics event in B2C Commerce corresponds to a URL pattern. The pattern begins with a call to the ReportingEvent-Start endpoint, followed by a collection of URL parameters for each event. The Salesforce Reference Architecture (SFRA) and SGJC reference applications use different techniques to construct the URLs.

The following sections describe the URL patterns for each Analytics event and provide information about where you view implementation details.

ABTest URL Pattern

Neither SFRA nor SGJC use the ABTest event. However, SGJC does provide a template (ReportABTesting.isml) that you can use to record this event.

URL Parameter Parameter Value
ID "ABTest" string
Name Test name, for example, "FastCheckout"
Segment Basket created or opened

For SGJC, the following code snippet from the ReportingABTesting.isml template shows how this URL pattern is constructed:


<isinclude url="${URLUtils.url('ReportingEvent-Start',
	'ID',  'ABTest',
	'Name',  pdict.TestName,
	'Segment',  pdict.BranchName
)}"/>

Top 10 Checkout Steps Report

SFRA and SGJC use the Checkout event. The Top 10 Checkout Steps Report requires that each step in the checkout process invokes the ReportingEvent-Start Controller. Each controller invocation has to contain the following information for each step in the process

URL Parameter Parameter Value
ID Set to string Checkout
BasketID Set to the universally unique identifier (UUID) or the basket being checkout out
Step Checkout step number
Name Checkout step name

For SFRA, see the helper method getCheckoutReportingURLs() in reportingUrls.js.

For SGJC, the following snippet shows how this URL pattern is constructed in the ReportCheckout.isml template:


            <iscontent type="text/html" charset="UTF-8" compact="true"/>
            <iscomment>
               Log event indicating checkout
               
               Logs the step depending on the parameters.
               step and name as parameter in page scope expected
               
               Make sure, that step can be ordered alphabetically because the reporting
               funnel display will use the step value to order the steps ascending.
               The name improves the display.
               
               DO NOT CHANGE THE LOCALE HERE. It just serves the purpose of logging the information
               to the analytics log file. The customer will never see it and the analytics module expects en_US.
               
               Parameters:
               
               checkoutstep    : the checkout step number
               checkoutname    : the name of the checkout
            </iscomment>
            <isscript>
               var locale = 'en_US';
            </isscript>
            
            <isset name="checkoutstep" value="${pdict.checkoutstep}" scope="page"/>
            <isset name="checkoutname" value="${pdict.checkoutname}" scope="page"/>
            
            <!-- Check for empty name of checkout step -->
            <isif condition="${empty(checkoutstep)}">
               <isset name="checkoutname" value="${'N/A'}" scope="page"/>
            </isif>
            
            <isinclude url="${URLUtils.url('ABTestEvent-StartCheckout')}"/>
            
            <isif condition="${empty(checkoutstep)}">
               <isinclude url="${URLUtils.url('ReportingEvent-Start',
                  'ID',                      'Checkout',
                  'BasketID',        pdict.Basket.UUID,
                  'Step',            StringUtils.formatNumber(1, '#,##0', locale),
                  'Name',        checkoutname
                  )}"/>
               <iselse/>
               <isinclude url="${URLUtils.url('ReportingEvent-Start',
                  'ID',                      'Checkout',
                  'BasketID',        pdict.Basket.UUID,
                  'Step',            StringUtils.formatNumber(checkoutstep, '#,##0', locale),
                  'Name',        checkoutname
                  )}"/>
            </isif>
         

Journey Funnel Report

The Shopper Journey Funnel Report also requires that ReportingEvent-Start Controller also be invoked when a shopper interacts with a basket or cart. Each controller invocation has to contain the following information

URL Parameter Parameter Value
ID Set to string BasketOpen
Basket ID Set to the id of the basket being opened
Items Set to the number of items in the basket
MerchandizeTotal (optional) The merchandise total
AdjMerchandizeTotal (optional) The adjusted merchandise total
AdjMerchandizeTotalPromo (optional) The merchandise total adjusted for promotions
ShippingTotal (optional) The Shipping total
AdjShippingTotal (optional) The adjusted shipping total

            <iscontent type="text/html" charset="UTF-8" compact="true"/>
            <iscomment>
               Log event indicating creation or use of cart
               
               DO NOT CHANGE THE LOCALE HERE. It just serves the purpose of logging the information
               to the analytics log file. The customer will never see it and the analytics module expects en_US.
            </iscomment>
            <isif condition="${!empty(pdict.Basket)}">
               <isscript>
                  var locale = 'en_US';
               </isscript>
               
               <isif condition="${!empty(pdict.Basket.allLineItems)}">
                  <iscomment>
                     Some common statistic for this cart
                  </iscomment>
                  <isinclude url="${URLUtils.url('ReportingEvent-Start',
                     'ID', 		'BasketOpen',
                     'BasketID', pdict.Basket.UUID,
                     'Items', 	StringUtils.formatNumber(pdict.Basket.productLineItems.length, '#,##0', locale),
                     
                     'MerchandizeTotal',	StringUtils.formatNumber(pdict.Basket.merchandizeTotalPrice.value, '#,##0.00', locale),
                     'AdjMerchandizeTotal',	StringUtils.formatNumber(pdict.Basket.getAdjustedMerchandizeTotalPrice(false).value, '#,##0.00', locale),
                     'AdjMerchandizeTotalPromo',	StringUtils.formatNumber(pdict.Basket.getAdjustedMerchandizeTotalPrice(true).value, '#,##0.00', locale),
                     
                     'ShippingTotal',	StringUtils.formatNumber(pdict.Basket.shippingTotalPrice.value, '#,##0.00', locale),
                     'AdjShippingTotal',	StringUtils.formatNumber(pdict.Basket.adjustedShippingTotalPrice.value, '#,##0.00', locale)
                     )}"/>
                  
               </isif>
            </isif>