Skip to content

Instantly share code, notes, and snippets.

Avatar
Check out npm.im/affiliate

Russell Steadman teamtofu

Check out npm.im/affiliate
View GitHub Profile
View aff.js
window["Affiliate"] =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
@teamtofu
teamtofu / affiliate_no_replace.js
Created Oct 9, 2020
Affiliate.js without replacing preexisting tags
View affiliate_no_replace.js
import Affiliate from 'affiliate';
const aff = Affiliate.create({
log: false,
modify: (url) => {
if (url.hostname === 'subdomain.mysite.com' && (!url.query || !url.query.tag)) {
url.set('query', {...url.query, tag: 'my-referral-tag'})
}
return url;