Last active
July 23, 2018 21:09
-
-
Save jtsternberg/af35121f209c4a65c4699bfbedf29149 to your computer and use it in GitHub Desktop.
Revisions
-
jtsternberg revised this gist
Apr 17, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,8 @@ jQuery( function( $ ) { } }; // Based on what we know from the docs, the event ids should be appended to the s.events string. // https://marketing.adobe.com/resources/help/en_US/sc/implement/events.html function trackEvent( eventId ) { if ( s.events && s.events.length ) { s.events += ',' + eventId; -
jtsternberg revised this gist
Apr 17, 2018 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ jQuery( function( $ ) { var campaignEventMap = { 'nklsasuw43ypqumlh7mn' : { // Campaign #1 'OptinMonsterOnShow' : 'event6', // Event ID from created event in Adobe for impressions. 'OptinMonsterOptinSuccess' : 'event7' // Event ID from created event in Adobe for conversions. }, 'l4eprc5lai8yn7f3vguq' : { // Campaign #2 'OptinMonsterOnShow' : 'event8', // Event ID from created event in Adobe for impressions. 'OptinMonsterOptinSuccess' : 'event9' // Event ID from created event in Adobe for conversions. } }; -
jtsternberg created this gist
Apr 17, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ jQuery( function( $ ) { var campaignEventMap = { 'nklsasuw43ypqumlh7mn' : { // Campaign #1 'OptinMonsterOnShow' : 'event6', // Event ID from created event in Adobe 'OptinMonsterOptinSuccess' : 'event7' // Event ID from created event in Adobe }, 'l4eprc5lai8yn7f3vguq' : { // Campaign #2 'OptinMonsterOnShow' : 'event8', // Event ID from created event in Adobe 'OptinMonsterOptinSuccess' : 'event9' // Event ID from created event in Adobe } }; function trackEvent( eventId ) { if ( s.events && s.events.length ) { s.events += ',' + eventId; } else { s.events = eventId; } } function mapAndTrackEvent( campaignSlug, eventType ) { var campaignEvts = campaignEventMap[ campaignSlug ]; if ( campaignEvts && campaignEvts[ eventType ] ) { trackEvent( campaignEvts[ eventType ] ); } } $( document ).on( 'OptinMonsterOnShow OptinMonsterOptinSuccess', function( evt, props, app ) { mapAndTrackEvent( app.getProp('optin'), evt.type ); }); });