Symptoms

As Provider I want to integrate the PBA Online Store with Google Analytics (GA) service to track visitors and report e-commerce activity.

Parallels provides official documentation how to include Google Analytics (GA) code into the PBA Online Store pages - Including Google Analytics.

This article provides examples of variables which can be used in the GA JavaScript code in the PBA Online Store pages to track parameters of customers' purchases.

Resolution

You may find information from Google website useful - Ecommerce Tracking - Web Tracking (ga.js), as variables you may use in GA code are described there and a couple of examples are present.

The parameters of customer's account and order being placed which you may use in the GA code in the PBA Online Store are described below.

  • Transaction ID: Order Number {$smarty.session.OrderInfo.Number} or Order ID {$smarty.session.OrderInfo.OrderID}
  • Total order amount: {$smarty.session.OrderInfo.Total|string_format:"%.2f"}
  • Total tax amount: {$smarty.session.OrderInfo.TaxTotal|string_format:"%.2f"}
  • Customer's location:
    • City: {$account->accountDetails.City}
    • State or province: {$StateName}
    • Country: {$account->accountDetails.Country}

Order may contain multiple items, the piece of JS code for each order item should be defined inside the loop structure like that:

{foreach name=oitem item=itemOrder from=$OrderDetails}
... actual code to process order items ...
{/foreach}

The following variables may be used for order items:

  • Transaction ID: Order Number {$smarty.session.OrderInfo.Number} or Order ID {$smarty.session.OrderInfo.OrderID} (same as above)
  • SKU/part number: either {$itemOrder.DetID} if you do not use SKUs or {$itemOrder.SKU} if they are defined and configured
  • Product name: {$itemOrder.Descr}
  • Category: this parameter is not required, may be left empty; if Sales CategoryID is needed you may use one of the variables $SalesCategoryID or $plan->attr->SalesCategoryID
  • Price: {$itemOrder.UnitPrice|string_format:"%.2f"}
  • Quantity: {$itemOrder.Quantity}

Internal content