Transactions and subscriptions¶
In Harvest we have build special support for transactions and subscriptions. In most web analytics solutions it is possible to track if a transaction occurred and sometimes it is possible to also track refunds. However, there is more to transactions and subscriptions than these actions.
Transactions¶
To track a basic transaction, you will use code like this:
harvest.trackEvent({
"event": "funnelstepview",
"data": {
"funnelName": "Checkout",
"funnelStep": "Success",
"transactionID": "1234",
"transactionRevenue": 500,
"transactionTax": 100,
"transactionShipping": 50,
"products": [{
"name": "Product A",
"price": 300,
"tax": 30
}, {
"name": "Product A",
"price": 150,
"tax": 15
}]
}
});
This tells Harvest there was a transaction with ID 1234 a price of 500 EUR (including taxes) and 2 products. If we track the transaction like this, Harvest makes the assumption that the transaction is both placed and fully paid.
We can however, be more detailed. In Harvest we have the following transaction actions:
- Placement
- Payment
- Refund
- Cancellation
This makes it possible to know how many transaction are placed, but never paid or how many transactions are cancelled after they are paid.
Placement¶
As mentioned above, by default we assume that a transaction is both placed and paid at the same time. We can distinguish this by specifying the transactionActions.
harvest.trackEvent({
"event": "funnelstepview",
"data": {
"funnelName": "Checkout",
"funnelStep": "Success",
"transactionActions": ["Placement"],
"transactionID": "1234",
"transactionRevenue": 500,
"transactionTax": 100,
"transactionShipping": 50,
"products": [{
"name": "Product A",
"price": 300,
"tax": 30
}, {
"name": "Product A",
"price": 150,
"tax": 15
}]
}
});
Then the user leaves website, because they are finished, but there will still be updates for the transaction. The transaction will be paid or perhaps cancelled or refunded.
To track these interactions, you can make use of our server-side tracking solution. For more information read our server-side tracking documentation.
Subscriptions¶
Some products that are purchased are not regular one-off sales. They are subscriptions. During a transaction, a subscription can be “requested”. This means that a customer would like to start with the subscription.
Usually, subscriptions are also “accepted” and “paid” right away, but it is possible that these events are not happening at the same time.
For example when submitting for an insurance or a loan, the company might want to do some checks before the subscription is accepted. It might even be rejected.
A product is a subscription when the following variables are added:
- subscriptionID
- subscriptionIntervals
- subscriptionIntervalValue
- subscriptionActions
- paymentValue
- paymentMethod
For more information checkout the subscription documentation.
An example of a transaction with a subscription that is requested and accepted can be seen below. In this case the payment should be sent later server-side.
harvest.trackEvent({
"event": "funnelstepview",
"data": {
"funnelName": "Checkout",
"funnelStep": "Success",
"transactionActions": ["Placement"],
"transactionID": "1234",
"transactionRevenue": 500,
"transactionTax": 100,
"transactionShipping": 50,
"products": [{
"name": "Product A",
"price": 300,
"tax": 30,
"subscriptionActions": ["Request","Acceptation"],
"subscriptionID": "123",
"subscriptionIntervals" : 12,
"subscriptionIntervalValue": 100
}]
}
});