If you are one of the many stores using Shopify as a core ecommerce platform, but you have rolled-your-own storefront or built pages using other tools, this guide is for you.

Littledata’s Shopify connection will work out the box in the following situations:

  1. If you have pages the customer must visit before checkout which are hosted by Shopify, and have Littledata’s tracking script added to the page template. This is typically a cart page as a minimum.
  2. You use the ReCharge checkout for recurring billing, and have Littledata’s integration with ReCharge activated.

Unfortunately it will not work in the following situations

  1. Customers are directed straight to Shopify’s checkout without seeing any Shopify storefront page first. We can’t add a script to Shopify’s checkout.
  2. Customers purchase on your own checkout, and you then send the order to Shopify via API.
  3. You use another 3rd party checkout, such as Bold Cashier, without any Shopify storefront. Bold relies on us to identify the cart the user is checking-out before their checkout page.

If you’re not sure which category your store is in, do ask our support team.

Integrating the hard way

There is a way you can still work with Littledata by sending us the Google Analytics client ID in the note_attributes of the Shopify order. Our webhook will then pick up that client ID and match the order to your customer’s web session.

Here’s how you would do this for our Google Analytics destination:

  1. Get the client ID from the _ga browser cookie set by Google Analytics.
  2. Add that value as a hidden field of your checkout, or otherwise pass it to your server.
  3. Set that client ID as the google-clientID field in the note_attributes object of the Shopify order.

An example of how to use GA’s analytics.js library to do that:

					

ga(function(){
  var tracker = ga.getAll()[0];
  if (tracker) {
    //you need to create this function to pass to Shopify with the order
    //or you can add it to the cart.attributes, and Littledata picks it up from there
    addNoteAttributesToShopifyOrder({
      google-clientID: tracker.get('clientId')
    })
  }
})

And here’s how you would do this for our Segment destination:

  1. Get the anonymous ID used by Segment’s Javascript library.
  2. Add that value as a hidden field of your checkout, or otherwise pass it to your server.
  3. Set that value as the segment-clientID field in the note_attributes object of the Shopify order.

An example of how to use  analytics.js to do that:

					

window.analytics.ready(function(){
  //you need to create this function to pass to Shopify with the order
  //or you can add it to the cart.attributes, and Littledata picks it up from there
  addNoteAttributesToShopifyOrder({
    segment-clientID: window.analytics.user().anonymousId()
  })
})