Implementing Rakuten’s conversion tracking pixel on Shopify and Shopify Plus stores can be tricky, but with the help of this tutorial, you’ll be able to do it in no time!

First, access the Rakeuten Performance Tag Pixel Tracking Implementation Guide here: https://rak.app.box.com/s/u32wzbyc30i9lnm4loza3in7f5be4t61

This guide will help you to understand the steps necessary to successfully implement the tracking pixel.

Step 1 : Paste the conversion code in your theme.liquid A Sample code will look like this

<!-- START Rakuten Marketing Tracking --> <script type="text/javascript"> (function (url) { /*Tracking Bootstrap Set Up DataLayer objects/properties here*/ if(!window.DataLayer){ window.DataLayer = {}; } if(!DataLayer.events){ DataLayer.events = {}; } DataLayer.events.SPIVersion = DataLayer.events.SPIVersion || "version"; DataLayer.events.SiteSection = "1"; var loc, ct = document.createElement("script"); ct.type = "text/javascript"; ct.async = true; ct.src = url; loc = document.getElementsByTagName('script')[0]; loc.parentNode.insertBefore(ct, loc); }(document.location.protocol + "//tag.rmp.rakuten.com/[CadenceID].ct.js")); </script> <!-- END Rakuten Marketing Tracking -->

You have to paste it right before the end of the tag to avoid loading delay of your store

Please make sure you replace the [CadenceID] to your ID.

Step 2: you’ll need to install the Rakuten tracking pixel on the ‘Thank You’ page of your Shopify or Shopify Plus store. This page is the page customers are taken to after they successfully complete their order.

In Shopify, go to Settings -> Checkout -> Order Status page and paste the tag to the additional tag script section.

The sample script provided by rakuten are like this

<!-- START of Rakuten Marketing Conversion Tag --> <script type="text/javascript"> var rm_trans = { affiliateConfig: {ranMID: "XXXXX", discountType: "item", includeStatus: "false"}, orderid: 'ORDERID', currency: 'USD', customerStatus: 'CUSTOMER_STATUS', conversionType: 'Sale', customerID: 'CUSTOMER_ID', discountCode: 'DISCOUNT_CODE', discountAmount: DISCOUNT_AMOUNT, taxAmount: TAX_AMOUNT, optionalData: {}, /*optional affiliate order level data*/ lineitems: [{ quantity: QUANTITY_PURCHASED, unitPrice: SINGLE_UNIT_ITEM_PRICE, unitPriceLessTax: SINGLE_UNIT_ITEM_PRICE_NO_TAX, SKU: 'PRODUCT_SKU', productName: 'PRODUCT_NAME', optionalData: {} /*optional affiliate item level data*/ }] }; /*Do not edit any information beneath this line*/ window.DataLayer?(DataLayer.events=DataLayer.events||{},DataLayer.Sale=DataLayer.Sale||{Bask et:rm_trans},DataLayer.Sale.Basket=DataLayer.Sale.Basket||rm_trans):window.DataLayer={Sale:{B asket:rm_trans},events:{}},DataLayer.events.SPIVersion="version",DataLayer.Sale.Basket.Ready=!0; </script> <!--END of Rakuten Marketing Conversion Tag -->

However, the current code is not optimized for a Shopify store. We will need to update it using Shopify Liquid in order to get accurate information from the cart and line items.

<script type="text/javascript"> {% if checkout.customer.has_account %} {% assign customer_status = "Existing" %} {% else %} {% assign customer_status = "New" %} {% endif %} var rm_trans = { affiliateConfig: {ranMID: "XXXXX", discountType: "item", includeStatus: "false"}, orderid : "{{ checkout.id}}", currency: "{{checkout.currency }}", customerStatus: "{{ customer_status }}", conversionType: "Sale", customerID: "{{checkout.customer.id }}", discountCode: "{{checkout.discount_applications[0].title}}", discountAmount: {{checkout.discounts_amount | divided_by: 100.00 }}, taxAmount:{{ checkout.tax_price | divided_by: 100.00 }}, optionalData: {}, /*THIS IS OPTIONAL*/ lineitems : [ {% for line_item in order.line_items %} { quantity : {{line_item.quantity}}, unitPrice : {{line_item.price | divided_by: 100.00 }}, SKU: "{{line_item.sku}}", productName: "{{line_item.product.title}}", }{% if forloop.last %}{% else %},{% endif %} {% endfor %} ] }; /*Do not edit any information beneath this line*/ window.DataLayer?(DataLayer.events=DataLayer.events||{},DataLayer.Sale=DataLayer.Sale||{Bask et:rm_trans},DataLayer.Sale.Basket=DataLayer.Sale.Basket||rm_trans):window.DataLayer={Sale:{B asket:rm_trans},events:{}},DataLayer.events.SPIVersion="version",DataLayer.Sale.Basket.Ready=!0; </script> <!--END of Rakuten Marketing Conversion Tag -->
  • Remember to change the ranMID to your store
  • Shopify discount code object is deprecate, we are using the discount code title instead.

After the implementation above, the Rakuten conversion should be track accurately in your store.

This article has provided the steps to ensure that your Rakuten conversions are accurately tracked in your store. Following these steps will ensure that you have the best understanding of your Rakuten performance and are getting the most out of your Rakuten campaigns.