Skip to content

Instantly share code, notes, and snippets.

@kylefox
Last active December 16, 2015 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylefox/5367916 to your computer and use it in GitHub Desktop.
Save kylefox/5367916 to your computer and use it in GitHub Desktop.
How to integrate Granify onto any website using the JavaScript API. (3 of 3)
<!--
Insert this snippet on the page shown to users after an order has been completed.
Place this code immediately before the closing </body> tag to ensure it's run last.
-->
<script type="text/javascript">
Granify.trackOrder({
"created_at": "2013-01-30 14:31:54",
"currency": "USD",
"total_line_items_price": 150.00,
"total_discounts": 25.00,
"subtotal_price": 125.00,
"total_tax": 0,
"total_price": 125.00,
"taxes_included": false,
"order_number": "100000010",
"financial_status": "paid",
"discount_codes": [{ "code": "SAVE25", "amount": 25.00 }],
"customer": {
"id": 1234,
"created_at": "2013-01-30 14:31:54",
"email": "jsmith@example.com",
"first_name": "John",
"last_name": "Smith"
},
"line_items": [
{
"price": 100.00,
"product_id": "1",
"quantity": 1,
"name": "Test product",
},
{
"price": 50.00,
"product_id": "2",
"quantity": 1,
"name": "Test product 2",
}
]
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment