Skip to content

Instantly share code, notes, and snippets.

@lstude
lstude / ga-ee-checkout-steps_go-init.html
Created February 27, 2020 02:29
track Shopify checkout steps and initialize Google Optimize on the checkout page
<script>
/**
* Google Analytics Enhanced Ecommerce - Checkout Labels & Google Optimize Initializer
* - to be added to the checkout.liquid template
*/
(function checkoutStepLabels() {
var DEBUG = window.location.href.indexOf('debug') > -1;
// setup recursive polling to wait for GA to be loaded by Shopify (i.e. after ga('create') call) before pushing event (check every 500ms, max of 20 attempts)
var attempts = 0;
var MAX_ATTEMPTS = 20;
@lstude
lstude / checkout_step_labels.html
Created October 25, 2019 17:45
Bebe checkout step labels - gtag.js
<script>
/**
* Google Analytics Enhanced Ecommerce - Checkout Labels
* - to be fired on all Checkout pages (after GA tag)
*/
// looks at `Shopify.Checkout` to determine which checkout step we're on, then pushes that step info to Google Enhanced Ecommerce for Checkout Labeling
(function(){
if (window.gtag && Shopify.Checkout) {
var ShopifyCheckoutstep = Shopify.Checkout.step;
switch (ShopifyCheckoutstep) {
@lstude
lstude / 0-README.md
Last active December 2, 2023 15:41
Add Indent / Outdent Functionality to Google Spreadsheets

This tutorial demonstrates how to add an "Indent Text" menu item to a Google spreadsheet so you can indent/outdent text.

  • When the "Indent Text" menu item is selected, any cells within a single column selection will be indented by 5 spaces.

  • You can increase or decrease the number of spaces the text is indented by changing the line below so that the "5" is changed to a larger or smaller number (depending on your preference):

newValues.push(['=CONCAT(REPT( CHAR( 160 ), 5),"' + values[i][0] + '")']);
@lstude
lstude / gist:10494492
Created April 11, 2014 19:27
manually bucket new vs returning customer
1) Set up test variations - control, returning visitor, new visitor
2) Set a cookie in each variation - one for new, another for returning
3) For new customers: If cookie matches new, bucket user into new variation. Else, bucket them into returning variation.
4) For returning customers: If cookie matches returning, bucket user into returning variation. Else, bucket them into new version.
5) API: window['optimizely'].push(["bucketVisitor", experimentId, variationId]); // https://www.optimizely.com/docs/api#bucket-visitor
/*
* superBowlLineup Object
*/
var superBowlLineup = {
date: "1/27/2014",
fireworksUsed: 534,
lightShow: true,
bands: [
{