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.

You must have to provide a valid id to post a transaction. Please make sure you first call PJDSDK.setCurrentUser(pjdSDKUser ,this) before reporting transaction data.

An entire list of transaction types is provided in Appendix B

Report Product Purchases

val transaction = PJDTransactions()
val productsList = ArrayList<Product>()
val product = Product()
product.currencyCode = "USD"
product.description = "description"
product.name = "Product Name"
productsList.add(product)
transaction.products = productsList
transaction.orderId = "100"
transaction.subtotal=80.0
transaction.tax=10.0
transaction.total= 90.0
transaction.userId= "[email protected]"
PJDSDK.reportEvent(Context, TransactionType.OTT_SUBSCRIPTION, transaction)

The attributes that are available to be populated for a transaction event are listed below.

SyntaxDescription
Product-
nameString
descriptionString
skuString
quantityInteger
totalDouble
taxDouble
priceDouble
metaHashMap<String,String> key/value pair
vendorString
currencyCodeString
Transaction-
typeString (ticketing, merch, food and bev, subscription, etc) for event types refer Appendix B
taxDouble (any tax assessed on the transaction)
totalDouble (the total monetary amount of the transaction)
orderIdString (Order ID from source system)
productsList of Product objects
metaHashmap<String,String>
transactedAtString (yyyy-mm-dd H:i:s)
subtotalDouble

Mandatory properties: From v1.7 BasicPermissions is a mandatory property.

SyntaxDescription
BasicPermissions-
cookiesCookies

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”