Skip to content

Instantly share code, notes, and snippets.

@m44-io
Last active March 4, 2019 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m44-io/23098ae58870490e30f2a565067976a8 to your computer and use it in GitHub Desktop.
Save m44-io/23098ae58870490e30f2a565067976a8 to your computer and use it in GitHub Desktop.
/*
This code will live on every single page.
It is a replacement for manually adding static script tags
to each page and it informs the gftracker with all
the information it needs. Also, you are not limited to just
the 4 examples you provided in case you need to add more later.
*/
function affiliate(id = '', product = '') {
var url = 'https://www.gftracker.com/rd/jpx.php',
get = { sid: 24, transid: id, event: product }
fetch(url + '?' + Object.keys(get).map(key => key + '=' + get[key]).join('&'), { mode: 'no-cors' })
.then(function(response) {})
}
/*
This code runs only on the purchase completed page
and triggers the above method with the correct data
to send to the tracker.
*/
affiliate('Fundamentals_Purchase', '310438')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment