Pumpjack Dataworks Analytics SDK

Transactions

The addTransaction function keeps a record of the transaction when a user purchases anything from your site. The reason to use this in combination with purchased is to enable more comprehensive transaction analytics. This function allows you to track the individual items purchased, how much the total purchase was, item descriptions, etc.

addTransaction() function

Adds a transaction to the analytics database. Includes product and price data.

Signature:
export declare function addTransaction(
orderId: string,
transaction: TransactionInput
): Promise<void>;

Parameters

ParameterTypeDescription
orderIdstringThe id of the order
transactionTransactionInputThe transaction with the respective products
Returns:

Promise<void>

TransactionInput interface

Properties

PropertyTypeDescription
meta?object(Optional) Additional properties assocaited to the transaction
order_id?string(Optional) The id of the order in your system, used for matching orders between your system and Pumpjack's
productsProduct[]The list of items contained in this order
subtotal?number(Optional) The total cost before tax
taxnumberTotal amount of tax
totalnumberTransaction total cost w/ tax included
type"ticket" | "merchandise" | "food_and_bev" | "ott_subscription" | "multi"The type of the transaction
user_id?string(Optional) The id of the user associated with this transaction.
transacted_at?Date(Optional)

Product interface

Properties

PropertyTypeDescription
currency_code?string(Optional) The currency code for the cost of the product. Uses ISO 4217 alpha codes
description?string(Optional) The description of the product
id?string(Optional)
meta?object(Optional) Any additional data to store in association to this product.
namestringThe name of the product
typestringThe type of the product
pricenumberThe price of a single one of this item w/o tax etc.
quantitynumberDescribes how many of this item are in the purchase
sku?string(Optional) The sku or product id
tax?number(Optional) How much tax is placed on this order for these items
total?number(Optional) The total cost associated with this item, including all quantity and tax.
vendor?string(Optional) The name of the vendor for the product