Pumpjack Dataworks Analytics SDK

Reporting Transactions

The SDK can report various types of transactions to the server. For any product sold, we can create a product, set transaction type, and provide additional attributes.

Report Product Purchases

let productPurchased = PJDSDKModel.Product()
productPurchased.name = "White Jersey - Nike"
productPurchased.productDescription = "White Jersey - Nike"
productPurchased.price = 25.80
productPurchased.quantity = 1
productPurchased.vendor = "Nike"
let productPurchased2 = PJDSDKModel.Product()
productPurchased.productDescription = "White Sneakers - Nike"
productPurchased.price = 100.00
productPurchased.quantity = 1
productPurchased.vendor = "Nike"
let transaction = PJDSDKModel.Transaction(with: permissions)
//see "Report User Attributes" section for how to create permissions
transaction.tax = 10.00
transaction.total = 135.80
transaction.orderID = "ORDID120039"
transaction.products = [productPurchased, productPurchased2]
transaction.userID = "[email protected]"
PJDSDK.sharedInstance.reportEvent(eventType: PJDTransactionType.MERCHANDISE, withTransaction: transaction)

The entire list is available here.

SyntaxDescription
PJDSDKModel.Product-
nameString
productDescriptionString
skuString
quantityInt
totalDouble (the total monetary amount of the transaction)
taxDouble [REQUIRED](any tax assessed on the transaction)
priceDouble [REQUIRED]
metakey/value pairs
vendorString
currencyCodeString (default is “USD”)
PJDSDKModel.Transaction-
userIDString [REQUIRED](UserID in createUser Req)
fingerprintString [REQUIRED] (UDID)
totalDouble [REQUIRED](the total monetary amount of the transaction)
taxDouble [REQUIRED] (any tax assessed on the transaction)
typeString (ticketing, merch, food and bev, subscription, etc) for event types refer Appendix B
orderIDString (Order ID from source system)
productsArray of PJDSDKModel.Product [REQUIRED]
metakey/value pairs
transactedAtString (yyyy-mm-dd H:i:s)
subtotalInt [REQUIRED]

Mandatory Properties

SyntaxDescription
permissionsPJDSDKModel.BasicPermissions

Note: From v1.7 The PJDSDKModel.Transaction class also requires PJDSDKModel.BasicPermissions as mandatory class property at the time of its init, in order to work, See section (#2-initialization) for how to create “permissions”