Transaction TAG

In order to track the sales generated after watching a Live Shopping event or a Highlight video, you need to install our transaction tracking tag on your order confirmation page (or the other element you need to track).

Prerequisite

  • This tag must be inserted on your order confirmation page.

  • This tag must always be inserted BEFORE the Aploze main JS TAG.

  • You always need to load the Aploze main JS TAG AFTER the transaction tracking tag.

Usage

Here what the transaction tracking tag looks like:

<!-- Start Aploze Transaction Tracking TAG -->
<script type="text/javascript">

// 1) The transaction object (Please update this part with order information)
var aplz_transac = {
  transactionId: 'my_transaction_ID',
  amount: 80, // Should be the sum of products' price * quantity (if there are any)
  products: [
    { id: 'my_product1_ID', price: 20, quantity: 1 },
    { id: 'my_product2_ID', price: 30, quantity: 2 }
  ]
}

// 2) The transaction storage (Please do not edit this part)
var tc=document.cookie.split('; ').find(function (c) { return c.startsWith('_aplz_tc');})||'';if(tc){var ts=tc.split('='),td=JSON.parse(ts[1]);td.transaction=aplz_transac;var d=new Date();d.setTime(d.getTime()+td.consent.expiration*864e5);document.cookie=ts[0]+'='+(JSON.stringify(td)||'')+'; expires='+d.toUTCString()+'; path=/';}

</script>

<!-- End Aploze Transaction Tracking TAG -->



The Transaction Tracking tag is split in 2 part:

  • 1) The transaction object: where you need to pass order information (transaction ID, Order Amount, product details)

  • 2) The transaction storage: where the transaction is stored into the Aploze Technical Cookie (you don't need to modify this part)

This transaction tracking tag only needs to be declared on the payment confirmation page. It should not be defined on the other pages of your website.

Which information do I need to pass?

Here all details you need to send to record a transaction:

  • transactionId : identifier of the order (mandatory - must be unique for each transaction) - STRING

  • amount : order amount (mandatory - must contain an amount, greater than 0.00 - the decimal delimiter must be a period). - NUMBER

  • products : order details (mandatory): - ARRAY

    • id : product ID - STRING

    • price : product price - NUMBER

    • quantity : product quantity - NUMBER

Product IDs must be relative to those entered in the administration panel.

If the values in the transaction do not have right format, the transaction will not be computed.

The transaction can not have empty values either.

How transactions are taken into account?

  • The transaction tracking tag must be present on the payment confirmation page (sales are recorded in the statistics)

  • The visitor must go to the payment confirmation page and stay long enough for the transaction tracking tag to be called

  • A sale is saved in Aploze if the required parameters are filled in the transaction code

  • The video watched and the sale must be carried out from the same browser.

  • A sale is associated with an Aploze LiveShopping Event or a Highlight Video.

Please contact us to get more infos about the attribution window.

By using a cookie, the transaction is recorded even if the user leaves the confirmation page before the Aploze library is fully loaded.

After, if the user navigates to another page where the Aploze library is present, the library will read the cookie and send the transaction to our servers. (and delete the transaction from the cookie)

Where can I see the transactions generated by Aploze?

In the administration panel, you can view all the statistics related to the Aploze solution. A new purchase section will be available as soon as a transaction is received on our servers.

Shopify Transaction Pixel

To track transactions via Shopify's new checkout feature "Shopify Extensibility", we have developed specific code to be added as a pixel on the following page: https://admin.shopify.com/settings/customer_events

// Corresponds to the ID of your Aploze channel,
// located in your channel URL (https://admin.aploze.com/[CHANNEL_ID])
const channelId = [CHANNEL_ID]; 

// Corresponds to the ID of your domain (already present on your JS tag),
// findable on the integration page of your channel
// (https://admin.aploze.com/[CHANNEL_ID]/edit)
// Integration tab -> [YOUR DOMAIN] -> Aploze Tag -> DOMAIN ID
const domainId = [DOMAIN_ID];

let analyticsCookie = {};

browser.cookie.get('_aplz_ac.' + domainId)
  .then((acCookie) => analyticsCookie = JSON.parse(acCookie))
  .catch(() => console.log('No analytics cookie found for Aploze Library'));

browser.cookie.get('_aplz_tc.' + domainId)
  .then((tcCookie) =>  {
    analytics.subscribe("checkout_completed", event => {
      const parsedTcCookie = JSON.parse(tcCookie);    
      
      const checkout = event.data.checkout;
      
      const products = checkout.lineItems.map((product) => ({
        id: product.id,
        title: product.title,
        quantity: product.quantity,
        price: product.variant.price.amount
      }));
      
      const transactionId = checkout.order.id;   
      
      const transaction = {
        transactionId: transactionId,
        amount: checkout.subtotalPrice.amount,
        products: products
      };   
  
      const analyticsEvent = {
        id: "transaction_id_" + transactionId,
        time: new Date().toISOString(),
        viewerId: parsedTcCookie.viewerId,
        channelId,
        ...analyticsCookie,
        data: {
          type: "LIBRARY_TRANSACTION_RECORDED",
          ...transaction,
          domainId
        }
      };
  
      const analyticsUrl = "https://prod.api.aploze.com/api/public/analytics";
      
      fetch(analyticsUrl, {
        method: "POST",
        body: JSON.stringify([analyticsEvent]),
        headers: { 'Content-Type': 'application/json' },
        keepalive: true
      });
    });
  })
  .catch(() => console.log('No technical cookie found for Aploze Library'));
pageAnalyze your eventspageAnalyze your performances

Last updated