Skip to content

Instantly share code, notes, and snippets.

@thomasgriffin
Created October 29, 2014 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasgriffin/3065685c64c023c748f1 to your computer and use it in GitHub Desktop.
Save thomasgriffin/3065685c64c023c748f1 to your computer and use it in GitHub Desktop.
Do custom conversion tracking for canvas in OptinMonster.
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