Created
October 29, 2014 18:46
-
-
Save thomasgriffin/3065685c64c023c748f1 to your computer and use it in GitHub Desktop.
Do custom conversion tracking for canvas in OptinMonster.
This file contains 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
jQuery(document).ready(function($){ | |
$(document).on('click', '.optin-monster-overlay .livechat_button a', function(e){ | |
// Prepare variables. | |
var $this = $(this), | |
optin = $this.closest('.optin-monster-overlay').attr('id').replace('om-', '').replace('-', '_'); | |
if ( ! window[optin] ) { | |
return; | |
} | |
// Send ajax request to track the optin. | |
var data = { | |
optin_monster_ajax_action: 'track_optinmonster_custom', | |
id: window[optin].getProp('id') | |
}; | |
$.post(window[optin].getProp('ajax'), data, function(res){}, 'json'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment