Track a transaction
If a transaction ID is specified, it will be checked for uniqueness to prevent duplicate transactions from being tracked.
By default, GoSquared calculates the total revenue and quantity amount from the items in the transaction. You may want to override this in some cases, such as when a discount was applied. This is possible by specifying revenue and quantity totals in the transaction options.
Note: It is not possible to remove test transactions from your Ecommerce dashboard. Therefore we highly recommend creating a test project in your GoSquared account before you start sending data to your production project.
The anonymous visitor ID that this action is associated with.
A valid ISO 8601 timestamp of when this transaction happened
IP address of the visitor. Used to detect the visitor's location
ISO 8601 timestamp of when this visitor/person last did a pageview
The People person ID that this action is associated with.
If the identifier used is an email it should be prefixed with
$transactionID = 'transaction-id'; $opts = array( // if you wish to explicitly set revenue and quantity totals // for this transaction, specify them here. They will be used // instead of the default totals calculated from the items. // 'revenue' => 50, // 'quantity' => 6 ); $transaction = $GS->Transaction($transactionID, $opts); $transaction->add_items(array( array( 'name' => 'Product 1', 'price' => 1, 'quantity' => 5 ), array( 'name' => 'Product 2', 'price' => 1, 'quantity' => 5 ) )); $response = $transaction->track(); // Associate transaction with a user $person = $GS->Person('user-id'); $transaction = $person->Transaction('transaction-id'); $transaction->add_item(array( 'name' => 'Product 1', 'price' => 1, 'quantity' => 5 )); $response = $transaction->track();
Live Responseundefined undefined
Your API Key is not authorised for this endpoint