Skip to content

Instantly share code, notes, and snippets.

View kmclaugh's full-sized avatar

Kevin McLaughlin kmclaugh

View GitHub Profile
@kmclaugh
kmclaugh / dashboard.js
Last active June 10, 2021 13:09
Rebaid Data Layer
/*
* action: dashboard
* description: fire on every dashboard page
* url: https://rebaid.com/dashbaord
* notes:
*/
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "dashboard",
eventName: "Dashboard",
@kmclaugh
kmclaugh / README.md
Last active May 5, 2021 17:28
ra sushi gift card datalayer

Below is the code that needs to be added when the user

  1. Adds a giftcard to the cart
  2. Begins checkout
  3. Completes the purchase of the giftcard

The {{variable}} templates need to be filled in with the actual values.

These changes should be made the checkout process starting the https://winreality.com/cart/#payment page. They will let us track the checkout and purchase events accurately in google analytics, other tracking pixels.

The update to purchase-form.html will attach source information directly to purchases and thus customers.

Here's a video description.

@kmclaugh
kmclaugh / README.md
Created April 1, 2021 16:09
Workwear Upsells Datalayer

The code below needs to be added/updated to the current Datalayer Events. The goal of the update is to be able to determine when a product is added to the cart via an upsell and which items in the purchase come were added via the upsell.

here's a video description

/**
* logger is an instance of AppEventsLogger and has been
* created using AppEventsLogger.newLogger() call.
* purchaseAmount is BigDecimal, e.g. BigDecimal.valueOf(4.32).
* currency is Currency, e.g. Currency.getInstance("USD"),
* where the string is from http://en.wikipedia.org/wiki/ISO_4217.
* parameters is Bundle.
*/
logger.logPurchase(purchaseAmount, 'USD', {
contents: itemsArray, // Same array as firebase
@kmclaugh
kmclaugh / ios-fb-sdk-flikshop.swift
Last active December 21, 2020 17:11
iOS FB SDK Flikshop
/**
* Call the built-in SDK function:
* amount is Double (required)
* currency is String from http://en.wikipedia.org/wiki/ISO_4217 (optional).
* parameters is ParametersDictionary (optional).
*/
AppEvent.purchased(
amount: purchaseAmount,
currency: "USD",
extraParameters: {
@kmclaugh
kmclaugh / credit_purchase_datalayer.js
Created December 7, 2020 16:46
Credit purchase datalayer for flikshop
// An example of what needs to be pushed to the datalayer when the user buys flikshop credits on the web app
// We want to treat the 1, 10, 20 credit options as individual products.
// The example below show what to push to the datalayer for the "10 Flikshop for $8.90" option.
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'purchase',
ecommerce: {
currency: 'USD',
value: 8.90, // Total revenue for the tansaction
tax: 0.00, // I think we don't have tax, correct?
@kmclaugh
kmclaugh / README.md
Last active September 19, 2020 15:13
Google Analytics Acquisition Information in Tag Manager

Replicate Google Analytics acquisition information (source, medium, GCLID, etc) as variables in Google Tag Manager.

Based on this Bounteous container.

Updated to include GCLID

See here for instructions.

@kmclaugh
kmclaugh / add-clientid-to-form.json
Created September 17, 2020 15:48
Add Client ID to Form Input
{
"exportFormatVersion": 2,
"exportTime": "2020-09-17 15:47:20",
"containerVersion": {
"path": "accounts/4701996609/containers/32482051/versions/0",
"accountId": "4701996609",
"containerId": "32482051",
"containerVersionId": "0",
"container": {
"path": "accounts/4701996609/containers/32482051",
@kmclaugh
kmclaugh / thank-you-page-conversion-recipe.json
Last active February 28, 2024 00:03
Google Tag Manager recipe for tracking pageview conversions
{
"exportFormatVersion": 2,
"exportTime": "2019-08-22 20:35:42",
"containerVersion": {
"path": "accounts/4701996609/containers/12749914/versions/0",
"accountId": "4701996609",
"containerId": "12749914",
"containerVersionId": "0",
"container": {
"path": "accounts/4701996609/containers/12749914",