Adding an E-commerce Tracking Code

Categories
Guide

Setting up your online store’s sales performance tracking in Plerdy requires basic HTML and JavaScript editing skills. If you’re not comfortable with this, consider seeking help from a specialist.

e-commerce tracking code

With Plerdy’s online store sales performance tracking, you can monitor key data such as:

  1. Number of transactions during a selected period.
  2. Number of unique users who made purchases.
  3. Total revenue of the online store.
  4. Conversion rate of the online store.
  5. Average order value.
  6. Quantity of products sold.


e-commerce tracking

These metrics are categorized by traffic type and device, allowing you to analyze which sources are most profitable. Furthermore, Plerdy helps identify which elements of your store contribute to successful orders and their generated profit.

Steps for Implementation

To initiate Plerdy’s sales performance data collection, follow these steps:

  1. Copy the following script template:
  2.     <script type="text/javascript" defer>
    var plerdysendData = {'type':'commerce', 'data':
    {'order_id':'ORDER_ID', 'money':'TOTAL_AMOUNT', 'quantity':'QUANTITY'}}
    </script>
  3. Replace ‘ORDER_ID’, ‘TOTAL_AMOUNT’, and ‘QUANTITY’ with dynamic variables reflecting your store’s transaction data.
  4. Install the edited script on your order success page.
  5. Create a test order and check the Sales Performance tab in Plerdy. Verify that the data matches your order details.
  6. If all data is correct, your sales performance tracking is now active.

Examples for Implementing Tracking Code

WordPress Woocommerce

You could add by automatically installing the WP plugin.

Shopify

You could add by automatically installing the Shopify app.

Magento

<script type="text/javascript" defer>    var plerdysendData = {'type':'commerce', 'data':
{'order_id':<php echo $block->getRealOrderId(); ?>, 'money': <? php echo
$order_details->total_paid; ?>, 'quantity':quantity}}
</script>

Opencart

\catalog\controller\checkout\success.php

Before $this->cart->clear();

$data['ids'] = $this->session->data['order_id'];
$data['products'] = $this->cart->getProducts();
$ids = $data['products'];
$money = 0;
$quantity = 0;
foreach ($ids as $idse){
$money = $money + $idse['total'];
$quantity = $quantity + $idse['quantity'];
}
$data['money'] = $money;
$data['quantity'] = $quantity;

\catalog\view\theme\...\template\common\success.twing\

<script type="text/javascript" defer>
var plerdysendData = {'type':'commerce', 'data':
{'order_id':{{ ids }} , 'money':{{ money }}, 'quantity':{{ quantity }} }}
</script>

CodeIgniter

{if strstr($CI->uri->uri_string(),'/order/view/')}
<script type="text/javascript" defer>
{literal}
var plerdysendData = {'type':'commerce', 'data': {'order_id':{/literal}
{echo$model->getId()}{literal},'money':{/literal}
{echo $model->getTotalPrice()}{literal}}}
{literal}
</script>
{/if}

Wix

<?php
$order = json_decode($order);
$orderid = $order[‘order’];
$orderid = $orderid[‘id’];
$ordertotal = $order[‘totals’];
$ordertotal = $ordertotal[‘total’];
$orderquantity = $ordertotal[‘quantity’];
?>
<script type="text/javascript" defer>
var plerdysendData = {'type':'commerce', 'data':
{'order_id':<?php echo $orderid; ?> , 'money': <?php echo $ordertotal; ?>
'quantity':<?php echo $orderquantity; ?>}}
</script>

Google Tag Manager

You could also add an e-commerce tracking code via GTM.

Testing

Perform the following steps on your page in Chrome Incognito:

  1. Click on various elements on a single page.
  2. Make a test purchase.
  3. In the menu panel, select “Today” and activate the report.

You will see which elements have been assigned the purchase amount.
e-commerce tracking code

Was this helpful?

Leave a reply for "Adding an E-commerce Tracking Code"

Your email address will not be published. Required fields are marked *