Last active
August 23, 2017 23:18
-
-
Save TimFletcher/357bf1a30f3bacd4406e83646bcb0fa6 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
// Requirements: You need to have the heddels snippet installed on every page so that the `tap` function exists | |
// NOTE: This is untested code!!! | |
// Bind an event handler for a successful Gravity forms submission | |
// https://www.gravityhelp.com/documentation/article/gform_confirmation_loaded/ | |
jQuery(document).bind('gform_confirmation_loaded', function(event, formId){ | |
// If you have any forms you DO NOT want this to run for, exclude them here | |
var excludedFormIds = []; | |
if (jQuery.inArray(formId, excludedFormIds)) return; | |
// If the tap function isn't defined, exit early. | |
if (typeof tap === 'undefined') return; | |
// Get the amount from the form | |
var id = (Math.random() + 1).toString(36).substring(2,7); | |
var total = jQuery('.ginput_total').text(); // e.g. "$905.00" | |
total = total.replace('$', ''); | |
total = total.split('.')[0]; | |
// Create the conversion | |
tap('conversion', 'falcon-garments-' + id , total, { program_group: 'falcon-garments' }); | |
}); |
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
<script src="//static.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script> | |
<script type="text/javascript"> | |
window['TapfiliateObject'] = i = 'tap'; | |
window[i] = window[i] || function () { | |
(window[i].q = window[i].q || []).push(arguments); | |
}; | |
tap('create', '2708-dea145'); | |
tap('detectClick'); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment