Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- Insights -->
- <script>
- window._ssstats = window._ssstats || [];
- _ssstats.push([
- 'configure', {
- accountId: 499421 // CHANGE TO YOUR ID
- }
- ]);
- </script>
- <script src="//cdn.statstrk01.com/assets/javascripts/sdk2.js" async></script>
- <script type="text/javascript">
- function setCookie(name, value, options) {
- options = options || {};
- var expires = options.expires;
- if (typeof expires == "number" && expires) {
- var d = new Date();
- d.setTime(d.getTime() + expires * 1000);
- expires = options.expires = d;
- }
- if (expires && expires.toUTCString) {
- options.expires = expires.toUTCString();
- }
- value = encodeURIComponent(value);
- var updatedCookie = name + "=" + value;
- for (var propName in options) {
- updatedCookie += "; " + propName;
- var propValue = options[propName];
- if (propValue !== true) {
- updatedCookie += "=" + propValue;
- }
- }
- document.cookie = updatedCookie;
- }
- function getCookie(name) {
- var matches = document.cookie.match(new RegExp(
- "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
- ));
- return matches ? decodeURIComponent(matches[1]) : undefined;
- }
- var products = [];
- i = 0;
- {% for item in checkout.line_items %}
- products[i] = {
- 'ImageURL': 'http:{{ item | img_url: 'small' }}',
- 'Name': {{ item.product.title | json }},
- 'ProductURL': '{{ shop.url }}{{ item.product.url }}',
- 'Quantity': '{{ item.quantity }}',
- 'Price': '{{ line_item.price | money_without_currency }}',
- 'SubTotal': '{{ item.line_price | money_without_currency }}'
- }
- i++
- {% endfor %}
- var orderID = getCookie('orderID');
- if (orderID != '{{ order_number }}') {
- _ssstats.push(['identify', {{ checkout.email | json}}]);
- _ssstats.push(['publish', 'Order Placed',
- {'Items': products,
- 'monetaryValue': {{checkout.total_price | money_without_currency}},
- 'orderId' : {{ order_number }},
- 'newsletter_signup': {{ checkout.buyer_accepts_marketing | json }}
- }
- ]);
- }
- //localStorage.orderID = {{ order_number }};
- setCookie('orderID', {{ order_number }})
- </script>
- <!-- /Insights -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement