Track Purchases

Sends information about a purchase made to Oribi. The second parameter is a JS object that provides data about the purchase.
Note: Any JavaScript code added to your website must be wrapped in <script> and </script> tags.

Code Example

 // Tracks the purchase event in Oribi
  ORIBI.api('trackPurchase', paramsObject);
fieldtypedescriptionexample
totalPriceNumber*required
The total amount the customer paid (after shipping, tax, discounts, etc). It can contain a fraction (e.g. a value of 1.5 can describe a price of $1.5)
{
 totalPrice: 1.5
}
Can describes a purchase of 1.5 for the store currency defined in the app (e.g. 1.5 US Dollars)
currencyString (3 ASCII characters)optional
A three letter ISO-4217 currency code of the currency the prices are in (case insensitive). If provided, it must be in one of our supported currencies (see below), from which it will be converted to the currency you chose in Oribi. If omitted, the store currency you set in Oribi will be used.
{
 totalPrice: 1200,
 currency: 'JPY'
}
Can describe a purchase of ¥1200. If the Oribi store currency in Oribi is not set to Japanese Yen, the prices in this purchase will be converted to it.
orderIdString (up to 64 ASCII characters)optional
An order identifier that will be shown in Oribi in the future to help you recognize specific purchases and will be used to make sure you don’t count the same purchase multiple times. If you send multiple purchases with the same (non-null) orderId, Oribi will only count the first purchase and ignore subsequent ones.
{
 totalPrice: 1,
 orderId: '8J+lsw=='
}

taxPriceNumber* optional
The tax paid for the purchase (in the same currency as the total price). (Default: 0)
{
 totalPrice: 5,
 currency: 'USD',
 taxPrice: 1.28
}
 Tracks a purchase for a grand total of $5.45, out of which $1.2 was for tax
shippingPriceNumber*optional
The additional price paid for the shipping of the purchased items (in the same currency as the total price). (Default: 0)
{
 totalPrice: 5.45,
 currency: 'NZD',
 shippingPrice: 1.2
}
Tracks a purchase for a grand total of $5.45, out of which $1.2 was for shipping
discountPriceNumber*optional
The discount for the purchase, if exists (in the same currency as the total price). (Default: 0)
{
 totalPrice: 5,
 discountPrice: 4
}
 Shows a discount of 4 (the price before discount was probably 9)
isFirstPurchaseBoolean*optional
True if the user who perform this purchase perform his first one in this site
{
 totalPrice: 5,
 isFirstPurchase: false
}

productsArrayoptional
The list of products purchased (see details below)
{
 totalPrice: 6,
 currency: 'EUR',
 products: [
  {
   name: 'Orange',
   id: 'ITEM-672643',
   price: 1.5,
   quantity: 4,
   categories: [
    'produce',
    'round-fruit'
   ]
  }
 ]
}
Buying 4 oranges, each one costing €1.5
products.nameString (up to 64 Unicode characters)optional
The name of the product. Will be used in the future to search or filter purchases.

Code Example

{
 totalPrice: 2,
 products: [
  {
   name: 'Orange',
  }
 ]
}

products.idString (up to 64 ASCII characters)optional
The String identifier of the product.
{
 totalPrice: 2,
 products: [
  {
   id: 'ITEM-672643',
  }
 ]
}

products.priceNumber*optional
The price for a single unit of the product.
{
 totalPrice: 2,
 currency: 'FJD',
 products: [
  {
   price: 2,
  }
 ]
}

products.discountPriceNumber*optional
The discount on specific product.
{
 totalPrice: 4,
 currency: 'FJD',
 products: [
  {
   price: 5,
   discountPrice: 4,
  }
 ]
}
Shows a discount of 4 (the price before discount was probably 9)
products.taxPriceNumber*optional
The tax price on specific product.
{
 totalPrice: 4.2,
 currency: 'FJD',
 products: [
  {
   price: 5,
   taxPrice: 0.8,
  }
 ]
}
Tracks a purchase for a grand total of $5, out of which $0.8 was for tax
products.quantityNumber (Positive Integer)optional
The amount of the product bought in this purchase. (Default: 1)

Code Example

{
 totalPrice: 3,
 currency: 'MZN',
 products: [
  {
   price: 1.5,
   quantity: 2,
  }
 ]
}

products.categoriesArrayoptional
An array of string categories. Will be used in the future to search and filter purchases.
{
 totalPrice: 3,
 currency: 'MZN',
 products: [
  {
   name: 'Men shower gel',
   categories: [
    'soap',
    'shampoo',
    'conditioners',
    'face-wash'
   ]
  }
 ]
}

field
totalPrice
type
Number*
description
required
The total amount the customer paid (after shipping, tax, discounts, etc). It can contain a fraction (e.g. a value of 1.5 can describe a price of $1.5)
example
{
 totalPrice: 1.5
}
Can describes a purchase of 1.5 for the store currency defined in the app (e.g. 1.5 US Dollars)

field
currency
type
String (3 ASCII characters)
description
optional
A three letter ISO-4217 currency code of the currency the prices are in (case insensitive). If provided, it must be in one of our supported currencies (see below), from which it will be converted to the currency you chose in Oribi. If omitted, the store currency you set in Oribi will be used.
example
{
 totalPrice: 1200,
 currency: 'JPY'
}
Can describe a purchase of ¥1200. If the Oribi store currency in Oribi is not set to Japanese Yen, the prices in this purchase will be converted to it.

field
orderId
type
String (up to 64 ASCII characters)
description
optional
An order identifier that will be shown in Oribi in the future to help you recognize specific purchases and will be used to make sure you don’t count the same purchase multiple times. If you send multiple purchases with the same (non-null) orderId, Oribi will only count the first purchase and ignore subsequent ones.
example
{
 totalPrice: 1,
 orderId: '8J+lsw=='
}


field
taxPrice
type
Number*
description
optional
The tax paid for the purchase (in the same currency as the total price). (Default: 0)
example
{
 totalPrice: 5,
 currency: 'USD',
 taxPrice: 1.28
}
 Tracks a purchase for a grand total of $5.45, out of which $1.2 was for tax

field
shippingPrice
type
Number*
description
optional
The additional price paid for the shipping of the purchased items (in the same currency as the total price). (Default: 0)
example
{
 totalPrice: 5.45,
 currency: 'NZD',
 shippingPrice: 1.2
}
Tracks a purchase for a grand total of $5.45, out of which $1.2 was for shipping

field
discountPrice
type
Number*
description
optional
The discount for the purchase, if exists (in the same currency as the total price). (Default: 0)
example
{
 totalPrice: 5,
 discountPrice: 4
}
 Shows a discount of 4 (the price before discount was probably 9)

field
isFirstPurchase
type
Boolean*
description
optional
True if the user who perform this purchase perform his first one in this site
example
{
 totalPrice: 5,
 isFirstPurchase: false
}


field
products
type
Array
description
optional
The list of products purchased (see details below)
example
{
 totalPrice: 6,
 currency: 'EUR',
 products: [
  {
   name: 'Orange',
   id: 'ITEM-672643',
   price: 1.5,
   quantity: 4,
   categories: [
    'produce',
    'round-fruit'
   ]
  }
 ]
}
Buying 4 oranges, each one costing €1.5

field
products.name
type
String (up to 64 Unicode characters)
description
optional
The name of the product. Will be used in the future to search or filter purchases.
example

Code Example

{
 totalPrice: 2,
 products: [
  {
   name: 'Orange',
  }
 ]
}


field
products.id
type
String (up to 64 ASCII characters)
description
optional
The String identifier of the product.
example
{
 totalPrice: 2,
 products: [
  {
   id: 'ITEM-672643',
  }
 ]
}


field
products.price
type
Number*
description
optional
The price for a single unit of the product.
example
{
 totalPrice: 2,
 currency: 'FJD',
 products: [
  {
   price: 2,
  }
 ]
}


field
products.discountPrice
type
Number*
description
optional
The discount on specific product.
example
{
 totalPrice: 4,
 currency: 'FJD',
 products: [
  {
   price: 5,
   discountPrice: 4,
  }
 ]
}
Shows a discount of 4 (the price before discount was probably 9)

field
products.taxPrice
type
Number*
description
optional
The tax price on specific product.
example
{
 totalPrice: 4.2,
 currency: 'FJD',
 products: [
  {
   price: 5,
   taxPrice: 0.8,
  }
 ]
}
Tracks a purchase for a grand total of $5, out of which $0.8 was for tax

field
products.quantity
type
Number (Positive Integer)
description
optional
The amount of the product bought in this purchase. (Default: 1)
example

Code Example

{
 totalPrice: 3,
 currency: 'MZN',
 products: [
  {
   price: 1.5,
   quantity: 2,
  }
 ]
}


field
products.categories
type
Array
description
optional
An array of string categories. Will be used in the future to search and filter purchases.
example
{
 totalPrice: 3,
 currency: 'MZN',
 products: [
  {
   name: 'Men shower gel',
   categories: [
    'soap',
    'shampoo',
    'conditioners',
    'face-wash'
   ]
  }
 ]
}


All prices should be passed as positive numbers and are saved in precision up to 3 decimal places (e.g. 12.345)
codecurrency
AEDUnited Arab Emirates Dirham
AFNAfghan Afghani
ALLAlbanian Lek
AMDArmenian Dram
ANGNetherlands Antillean Guilder
AOAAngolan Kwanza
ARSArgentine Peso
AUDAustralian Dollar
AWGAruban Florin
AZNAzerbaijani Manat
BAMBosnia-Herzegovina Convertible Mark
BBDBarbadian Dollar
BDTBangladeshi Taka
BGNBulgarian Lev
BHDBahraini Dinar
BIFBurundian Franc
BMDBermudan Dollar
BNDBrunei Dollar
BOBBolivian Boliviano
BRLBrazilian Real
BSDBahamian Dollar
BTCBitcoin
BTNBhutanese Ngultrum
BWPBotswanan Pula
BYNBelarusian Ruble
BZDBelize Dollar
CADCanadian Dollar
CDFCongolese Franc
CHFSwiss Franc
CLFChilean Unit of Account (UF)
CLPChilean Peso
CNHChinese Yuan (Offshore)
CNYChinese Yuan
COPColombian Peso
CRCCosta Rican Colón
CUCCuban Convertible Peso
CUPCuban Peso
CVECape Verdean Escudo
CZKCzech Republic Koruna
DJFDjiboutian Franc
DKKDanish Krone
DOPDominican Peso
DZDAlgerian Dinar
EGPEgyptian Pound
ERNEritrean Nakfa
ETBEthiopian Birr
EUREuro
FJDFijian Dollar
FKPFalkland Islands Pound
GBPBritish Pound Sterling
GELGeorgian Lari
GGPGuernsey Pound
GHSGhanaian Cedi
GIPGibraltar Pound
GMDGambian Dalasi
GNFGuinean Franc
GTQGuatemalan Quetzal
GYDGuyanaese Dollar
HKDHong Kong Dollar
HNLHonduran Lempira
HRKCroatian Kuna
HTGHaitian Gourde
HUFHungarian Forint
IDRIndonesian Rupiah
ILSIsraeli New Sheqel
IMPManx pound
INRIndian Rupee
IQDIraqi Dinar
IRRIranian Rial
ISKIcelandic Króna
JEPJersey Pound
JMDJamaican Dollar
JODJordanian Dinar
JPYJapanese Yen
KESKenyan Shilling
KGSKyrgystani Som
KHRCambodian Riel
KMFComorian Franc
KPWNorth Korean Won
KRWSouth Korean Won
KWDKuwaiti Dinar
KYDCayman Islands Dollar
KZTKazakhstani Tenge
LAKLaotian Kip
LBPLebanese Pound
LKRSri Lankan Rupee
LRDLiberian Dollar
LSLLesotho Loti
LYDLibyan Dinar
MADMoroccan Dirham
MDLMoldovan Leu
MGAMalagasy Ariary
MKDMacedonian Denar
MMKMyanma Kyat
MNTMongolian Tugrik
MOPMacanese Pataca
MROMauritanian Ouguiya (pre-2018)
MRUMauritanian Ouguiya
MURMauritian Rupee
MVRMaldivian Rufiyaa
MWKMalawian Kwacha
MXNMexican Peso
MYRMalaysian Ringgit
MZNMozambican Metical
NADNamibian Dollar
NGNNigerian Naira
NIONicaraguan Córdoba
NOKNorwegian Krone
NPRNepalese Rupee
NZDNew Zealand Dollar
OMROmani Rial
PABPanamanian Balboa
PENPeruvian Nuevo Sol
PGKPapua New Guinean Kina
PHPPhilippine Peso
PKRPakistani Rupee
PLNPolish Zloty
PYGParaguayan Guarani
QARQatari Rial
RONRomanian Leu
RSDSerbian Dinar
RUBRussian Ruble
RWFRwandan Franc
SARSaudi Riyal
SBDSolomon Islands Dollar
SCRSeychellois Rupee
SDGSudanese Pound
SEKSwedish Krona
SGDSingapore Dollar
SHPSaint Helena Pound
SLLSierra Leonean Leone
SOSSomali Shilling
SRDSurinamese Dollar
SSPSouth Sudanese Pound
STDSão Tomé and Príncipe Dobra (pre-2018)
STNSão Tomé and Príncipe Dobra
SVCSalvadoran Colón
SYPSyrian Pound
SZLSwazi Lilangeni
THBThai Baht
TJSTajikistani Somoni
TMTTurkmenistani Manat
TNDTunisian Dinar
TOPTongan Paanga
TRYTurkish Lira
TTDTrinidad and Tobago Dollar
TWDNew Taiwan Dollar
TZSTanzanian Shilling
UAHUkrainian Hryvnia
UGXUgandan Shilling
USDUnited States Dollar
UYUUruguayan Peso
UZSUzbekistan Som
VEFVenezuelan Bolívar Fuerte (Old)
VESVenezuelan Bolívar Soberano
VNDVietnamese Dong
VUVVanuatu Vatu
WSTSamoan Tala
XAFCFA Franc BEAC
XAGSilver Ounce
XAUGold Ounce
XCDEast Caribbean Dollar
XDRSpecial Drawing Rights
XOFCFA Franc BCEAO
XPDPalladium Ounce
XPFCFP Franc
XPTPlatinum Ounce
YERYemeni Rial
ZARSouth African Rand
ZMWZambian Kwacha
ZWLZimbabwean Dollar