Custom Tracking Scripts in Bold Cashier

 Caution

This article requires significant knowledge of JavaScript. If you are not comfortable with JavaScript, we strongly suggest contacting your developer before proceeding.

Overview

With Bold Cashier, you can use custom tracking scripts to customize the information that gets sent to Google Analytics and Facebook Pixel. You can also integrate with other analytics and tracking services, that are not directly integrated with Cashier, to track successful purchases.

Note: Visit Integration Hub for Bold Cashier for more information on how to link your tracking accounts to Cashier.

If you need some help in creating a script to add to Bold Cashier, you can reach out to Shopify Experts through StoreTasker.

To set up custom tracking scripts in Cashier, please follow these steps:

Cashier Tracking Scripts

While in the Bold Cashier app, navigate to Settings > Analytics. 

Setup

While in the Analytics setting, scroll down to "Custom Script" and enable to toggle beside "Enable custom script". After this has been enabled, enter in your custom script(s) and then select Save

Limitations

There are a few limitations when it comes to custom tracking scripts.

  • The custom scripts cannot include <script> tags. This includes script tags that call external javascript.
  • Liquid code cannot be used for variables, because the correct values will not be populated. You will need to use Bold Variables.
  • There are certain types of script that won't work in the custom scripts section of Bold Cashier.
    • Any script that adds anything to the checkout. Such as an image, a popup, a link, an input field.
    • Any service that does heat mapping to track how your customer interacts with the checkout.
    • Anything that requires Google Tag Manager, or anything that requires code being added in the <head> of the checkout.
  • The custom tracking scripts only run on the Thank You Page, to track successful purchases.
 Pro-Tip

Cashier has an integration with Google Tag Manager to allow you more control over your analytics.

Variables

These are some of the order parameters you can use to create your custom scripts:

  • BOLD.order.id: The ID number of the customer's order, in Cashier.
  • BOLD.order.currency: The currency the order was purchased in.
  • BOLD.order.customer.email: The customer's email address.
  • BOLD.order.billing_address.province_code: The province or state ID code (Manitoba = MB).
  • BOLD.order.billing_address.country_code: The customer's country ID code (Canada = CA).
  • BOLD.order.line_items.sku: The item's SKU number.
  • BOLD.order.line_items.title: The product title (product name).
  • BOLD.order.line_items.price: The price of the item in the lowest denomination ($39.95 = 3995).
  • BOLD.order.line_items.quantity: The quantity of a purchased product.
  • BOLD.order.line_items.platform_variant_id: The item's Shopify variant ID.
  • BOLD.order.line_items.platform_product_id: The item's Shopify product ID.
  • BOLD.order.subtotal: The order's subtotal in the lowest denomination ($39.95 = 3995).
  • BOLD.order.total_shipping: The total cost of shipping.
  • BOLD.order.total_tax: The total amount of taxes on the order.
  • BOLD.order.total: The complete order total cost (including tax and shipping).

Our Analytics Documentation has more information about what's available in the order object. 

Troubleshooting

When it comes to loading in an external script, it is usually done by using script tags.

Example:

<script src="https://www.domain.com/script.js"></script>

However, Cashier doesn't allow you to add script tags into the custom tracking scripts. You can use the following code to load an external script.

var script = document.createElement("script");  // create a script DOM node
script.src = url; // set its src to the provided URL

document.head.appendChild(script); // add it to the end of the head section of the page (could change 'head' to 'body' to add it to the end of the body section instead)
Was this article helpful?
0 out of 0 found this helpful