Skip to content

Instantly share code, notes, and snippets.

View iamkevingreen's full-sized avatar
💭
🍝 🍝 🍝 🍝 🍝 🍝

Kevin Green iamkevingreen

💭
🍝 🍝 🍝 🍝 🍝 🍝
View GitHub Profile
@mikehwagz
mikehwagz / analytics.js
Last active January 31, 2021 02:12
basic gtm pattern + enhanced commerce
const BRAND_NAME = 'Lorem Ipsum'
export function gtmProduct(product, variant) {
return {
name: product.title,
id: variant.sku,
price: parseFloat(variant.price),
variant: variant.title,
brand: BRAND_NAME,
category: 'All',
/*------------------------
Libraries
------------------------*/
const axios = require("axios");
const fs = require("fs");
const FormData = require("form-data");
/*------------------------
Download the file.
Good article on how to download a file and send with form data - https://maximorlov.com/send-a-file-with-axios-in-nodejs/