The MOO API offers the ability to know when customers have placed orders on the MOO website through your API application.
How does it work?
When a customer places an order on the MOO website, we display a confirmation page to them. If you enable your application to track orders, we arrange for this page to make an AJAX call to your application from the customer's browser to tell you that a purchase has been made, along with a unique tracking ID supplied by your application for you to track your users easily.
How do I use this feature?
To use this functionality, you need to provide 2 pieces of information:
- An Order Confirmation Callback URL on your API key registration form. Existing users can edit their API key configuration here.
- A trackingId on your moo.pack.createPack call. This must be a string of 1 - 255 characters.
BOTH the confirmation callback URL and the trackingId must be used in order to access the feature.
Your application must generate the tracking ID, but it does not have to be unique per call. You can for instance choose to track on a customer-by-customer basis and re-use the same tracking ID for the same user across multiple packs.
The confirmation page will make a callback to your application for each pack design that was purchased in the transaction (if the customer increases the quantity of packs they wish to purchase within the MOO Cart, this still only results in 1 callback)
If multiple packs created via API applications are purchases in the same transaction, multiple callbacks will be made (including to different API applications if the customer has purchased packs via more than 1 API application)
You can happily configure the callback URL as
http://localhost:8080/developmentCallback for instance on your development MOO API key, as your browser is making the request, not our servers - but do remember to use something publically accessible over the internet for production use!
How does it make the callback?
If you have provided both a confirmation callback URL on your API key registration, and a trackingId when creating the Pack, then when a user places an order and their browser views the MOO confirmation page, we will insert an hidden
<img/> tag which makes a request back to your server, passing a
trackingId parameter via our JQuery library. So in the event of the URL being
http://my-api-application.example.com/mooOrderCallback and a trackingId or
<div id="apiCallbacks" class="hide"></div>
which will add the following to the DOM:
<div id="apiCallbacks" class="hide">
thus making the browser load the image. Your code need not return any content at all (and any content it does return will not be displayed to the user)
Does MOO store the tracking ID?
Yes we do. There are 2 reasons for this. Firstly, it means that should you decide you want to ask us about a particular pack, we can uniquely identify it within our systems without you having to be aware of who the actual end customer is. Secondly, we will likely want to provide the feature for API application key holders to be able to generate reports from our systems (Not available yet!) in which case it makes sense for us to be able to include your tracking IDs within such reports
We will not pass your tracking IDs to third parties (other than the Order Confirmation Callback URL you configure through your API key registration)