Last active
March 4, 2019 06:39
-
-
Save m44-io/23098ae58870490e30f2a565067976a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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