Skip to content

Instantly share code, notes, and snippets.

@tpitre
Created October 4, 2018 19:04
Show Gist options
  • Save tpitre/f54111f1ff78f25b490a62588848940d to your computer and use it in GitHub Desktop.
Save tpitre/f54111f1ff78f25b490a62588848940d to your computer and use it in GitHub Desktop.
Dynamically add pixel once "Reserve Now" button is clicked
// These events fire for all "Reserve Now" buttons on both Delmonico Steakhouse and Emeril's New Orleans Fish House sections.
// ENOFH tracking script for reserve buttons.
$('.page-node-470 .btn__reserve').each(function() {
$(this).click(function(e) {
// DOM: Create the script element
var jsElm = document.createElement("script");
// set the type attribute
jsElm.type = "application/javascript";
// make the script element load a Simpli.fi one-off tag
jsElm.src = "https://tag.simpli.fi/sifitag/[50729940-a3d3-0136-d733-06a9ed4ca31b]";
// finally insert the element to the body element in order to load the script
document.body.appendChild(jsElm);
});
});
// Delmonico Steakhouse tracking script for reserve buttons.
$('.page-node-409 .btn__reserve').each(function() {
$(this).click(function(e) {
// DOM: Create the script element
var jsElm = document.createElement("script");
// set the type attribute
jsElm.type = "application/javascript";
// make the script element load a Simpli.fi one-off tag
jsElm.src = "https://tag.simpli.fi/sifitag/[3b0f7220-a3d4-0136-5057-067f653fa718]";
// finally insert the element to the body element in order to load the script
document.body.appendChild(jsElm);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment