Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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 = '',
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