livechatinc

Shopify, clean custom vars LiveChat Inc.

Dec 30th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2.     window.__lc = window.__lc || {};
  3.     window.__lc.license = 'licence_number';
  4.     function strip_tags(input, allowed) {
  5.       allowed = (((allowed || '') + '')
  6.         .toLowerCase()
  7.         .match(/<[a-z][a-z0-9]*>/g) || [])
  8.         .join(''); // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>)
  9.       var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
  10.         commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
  11.       return input.replace(commentsAndPhpTags, '')
  12.         .replace(tags, function($0, $1) {
  13.           return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
  14.         });
  15.     };
  16.  
  17.     var totalPrice = strip_tags('{{ cart.total_price | money }}');
  18.     window.__lc.params = [
  19.     { name: 'Cart', value: totalPrice },
  20.     { name: 'Order number', value: '{{ order.order_number }}' }
  21.     ];
  22.     (function() {
  23.     var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
  24.     lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
  25.     var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
  26.     })();
  27. </script>
Add Comment
Please, Sign In to add comment