edx/edx-platform — pull request #5946 by stephensanchez (2014-11-13 14:23:16+00:00)
Title: Adding new Google Analytics eCommerce event to shoppingcart.

This PR is for task ECOM-546 to add new google analytics events to shopping cart purchases. Now, when an Order's purchase function is invoked, an isolated function will emit an event to GA. This is wrapped in a 'catch all' to prevent any error interrupting the purchase transaction.

Tests included.

Raw output from the event is as follows when tested:
{
"timestamp": "2014-11-12T21:09:05.186Z",
"userId": "13",
"properties": {
"orderId": 10,
"currency": "usd",
"total": "12.00",
"products": [
{
"sku": "SteveU/Steve201/Sanchfinity",
"category": "Donation ",
"price": "12.00",
"id": 10,
"quantity": 1
}
]
},
"context": {
"library": {
"name": "analytics-python",
"version": "unknown"
}
},
"event": "Completed Order",
"writeKey": "XXXXXXX",
"receivedAt": "2014-11-12T21:23:21.101Z",
"type": "track",
"messageId": "XXXXXXX",
"integrations": {
"Google Analytics": {
"clientId": null
}
}
}

@rlucioni @wedaly please review