Skip to content

Instantly share code, notes, and snippets.

@aaroneaton
Created June 11, 2015 18:25
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 aaroneaton/30f14fe6dadea04fca18 to your computer and use it in GitHub Desktop.
Save aaroneaton/30f14fe6dadea04fca18 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
// We want to store a global reference to the proper optin object to make use of tracking methods.
var om_ref;
jQuery(document).ready(function($){
// Gain access once the entire object is loaded.
$(document).on('OptinMonsterLoaded', function(e, props, obj){
// Replace jshdgfgshf with the unique optin slug you want to target.
if ( 'uv7nlvrd513vds1n' == obj.getProp('optin') ) {
om_ref = obj;
}
});
// Register click handler to trigger the success call.
$(document).on('click', '.optin-lead-link', function(){
om_ref.trackEvent('conversion', om_ref.getProp('ga_campaign'), om_ref.getProp('ga_campaign_id'));
});
});
</script>
@juanjdlt
Copy link

juanjdlt commented Oct 8, 2015

Hi J. Aaron, it seems the trackEvent method is no longer supported, which method shelled we use now?

@aaroneaton
Copy link
Author

Hey Juan,
We haven't removed that method from our API. You may want to add a check for that om_ref object before creating the conversion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment