Transactions are collected and processed automatically as you report them in events/dataLayer.
Transaction import can be handy for:
- Older transactions before the time Persoo was deployed to your eshop
- Transactions from brick&mortar stores (to have more interactions about users, to improve crosssell data, …). This is typically a regular once-a-day import.
Importing transactions
Typicaly, an e-shop database has 2 tables – transactions and transaction items.
Here are 3 examples importing the same transaction.
Example 1 (CSV import):
1 2 3 4 |
transactionId,timestamp,email,affiliation,revenue,shipping,tax,total,itemID,itemGroupID,quantity,price,brand,categoryID trans123,1468013514538,test@test.com,myStore,125,10,10,145,,,,,, trans123,,,,,,,,14312,BRX110,1,50,BRIXTON,ksiltovky trans123,,,,,,,,14324,BRX122,1,75,BRIXTON,ksiltovky |
Example 2 (JSON import):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
[ { "email": "test@test.com", "transactionId": "trans123", "timestamp": 1468013514538, "affiliation": "myStore", "revenue": 125.0, "shipping": 10.0, "tax": 10.0, "total": 145.0 }, { "transactionId": "trans123", "itemID": "14312", "brand": "BRIXTON", "categoryID": "ksiltovky", "itemGroupID": "BRX110", "quantity": 1, "price": 50 }, { "transactionId": "trans123", "itemID": "14324", "brand": "BRIXTON", "categoryID": "ksiltovky", "itemGroupID": "BRX110", "quantity": 1, "price": 75 } ] |
Example 3 (JSON import): importing final transaction items, so there is no map-reduce of transations and transaction items.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
[ { "email": "test@test.com", "transactionId": "trans123", "timestamp": 1468013514538, "affiliation": "myStore", "revenue": 125.0, "shipping": 10.0, "tax": 10.0, "total": 145.0, "items": { "14312": { "brand": "BRIXTON", "categoryID": "ksiltovky", "itemGroupID": "BRX110", "quantity": 1, "price": 50 }, "14324": { "brand": "BRIXTON", "categoryID": "ksiltovky", "itemGroupID": "BRX122", "quantity": 1, "price": 75 } } } ] |
To make it easier, you can create one file (CSV or JSON) with both transactions and transaction items. You can simply concat these two tables. In the import file some lines correspond to transactions and they must provide:
- transactionId
- affiliation
- revenue
- shipping
- tax
- total = revenue + shipping + tax
- items (optional) … you can provide transaction items directly, so no single line transaction items are neccessary
and other lines with transaction items
- transactionId
- itemID
- itemGroupID
- quantity
- price
- brand
- categoryID
- productType, … and other fields describing group of products or product features
Persoo maps all lines with unique transactionId to one transaction item, which will be imported.
Note: Pair [transactionId, visitor identification] must be unique. If you upload the transaction with the same transactionID and visitor identification again, it will overwrite previous transaction.