Custom Meta Fields
How to record custom analytics data on an order
If you are building your own attribution system, you can pass custom meta fields that will be recorded on the order and can be retrieved server-side via our Order API
To add custom meta fields, add your parameters to the checkout URL by setting a cartUrlParams
promise. Each key string should start in the format meta_
.
Here is a basic example to define an affiliate
value to 123XYZ
:
window.document.addEventListener('vinoshipper:loaded', () => {
window.Vinoshipper.init(000, {
cartUrlParams: () => {
return Promise.resolve([
{
key: 'meta_affiliate',
value: '123XYX',
}
])
},
})
})
When set properly, the completed order will be returned from the Order API as:
metaFields: {
affiliate: "123XYX"
}
Updated about 16 hours ago