Skip to content

Instantly share code, notes, and snippets.

View designjockey's full-sized avatar

Ritesh Manchanda designjockey

View GitHub Profile
@designjockey
designjockey / shopify.datalayer.html
Created July 27, 2021 00:56 — forked from samba/shopify.datalayer.html
Shopify DataLayer Checkout
{% if first_time_accessed %}
<script>
(function(dataLayer){
var customer_type = ({{customer.orders_count}} > 1) ? 'repeatcustomer' : 'newcustomer';
var discounts = "{{ order.discounts | map: 'code' | join: ',' | upcase}}";
function strip(text){
return text.replace(/\s+/, ' ').replace(/^\s+/, '').replace(/\s+$/, '');
}