Skip to content

Instantly share code, notes, and snippets.

😎
Awesome Motive-ing

Justin Sternberg jtsternberg

😎
Awesome Motive-ing
Block or report user

Report or block jtsternberg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jtsternberg
jtsternberg / filter-om-campaigns-by-name.php
Last active Mar 14, 2019
Filter OptinMonster campaigns loaded into WordPress by name
View filter-om-campaigns-by-name.php
<?php
function filter_om_campaigns_by_name( $campaigns, $save ) {
// Make sure this is the refresh request and that we have data.
if ( ! isset( $campaigns->success ) && ! empty( $campaigns ) ) {
// Loop through the campaigns
foreach ( (array) $campaigns as $slug => $campaign ) {
@jtsternberg
jtsternberg / am-ascii.html
Last active Feb 4, 2019
AwesomeMotive ascii
View am-ascii.html
<pre>
````````````````````````````````````````````````````````````````````````````````````````````````````
````````````````````````````````````````````````````````````````````````````````````````````````````
````````````````````````````````````````````````````````````````````````````````````````````````````
````````````````````````````````````````````````````````````````````````````````````````````````````
````````````````````````````````````````````````````````````````````````````````````````````````````
````````````````````````````````````````````````````````````````````````````````````````````````````
````````````````````````````````````````````````````````````````````````````````````````````````````
````````````````````````````````````````````````````````````````````````````````````````````````````
@jtsternberg
jtsternberg / om-webhook-arbitrary-data.html
Created Jan 16, 2019
send arbitrary to the webhook via the debugInfo field
View om-webhook-arbitrary-data.html
<script>
document.addEventListener('om.Form.init', function( evt ) {
var { Campaign } = evt.detail;
var input;
// Only do this for a specific campaign
if ( '<slug>' !== Campaign.id ) {
return;
}
@jtsternberg
jtsternberg / add-x++-language-to-cpt-plugin.php
Created Jan 16, 2019
Add additional languages to code-snippet-cpt plugin
View add-x++-language-to-cpt-plugin.php
<?php
add_action( 'admin_init', function() {
$exists = get_term_by( 'slug', 'xpp', $taxonomy );
if ( empty( $exists ) ) {
$result = wp_insert_term( 'X++', 'languages', array( 'slug' => 'xpp' ) );
wp_die( '<xmp>'. __LINE__ .') $result: '. print_r( $result, true ) .'</xmp>', 'Debug' );
}
wp_die( '<xmp>'. __LINE__ .') $exists: '. print_r( $exists, true ) .'</xmp>', 'Debug' );
} );
@jtsternberg
jtsternberg / meh-rathon-countdown-alarm.js
Last active Apr 1, 2019
meh.com meh-RATHON! countdown alarm
View meh-rathon-countdown-alarm.js
clear();
var cdSettings = {
debug: true,
evt: null,
audio: null,
audioUrl: 'https://jtsternberg.com/file-drop/analog-watch-alarm_daniel-simion.mp3',
secondsLeft: 0,
timeLeft: 0,
log: true,
alarming: false,
@jtsternberg
jtsternberg / om-redirect-with-existing-query-args.js
Created Nov 21, 2018
On OM redirect action, append any existing query args to the redirect url
View om-redirect-with-existing-query-args.js
document.addEventListener('om.Action.redirect', function(evt) {
var action = evt.detail.Action;
// Take existing url and append any query args on current url.
action.options.url += ( action.options.url.indexOf('?') > -1 ? '&' : '?' ) + window.location.search.substr(1);
});
@jtsternberg
jtsternberg / om.Analytics.track-example.js
Last active Nov 15, 2018 — forked from brianaohern/om-Analytics-conversion-example.js
om.Analytics.track Example using Google Tag Manager to track a specific event in our Google Analytics account.
View om.Analytics.track-example.js
document.addEventListener('om.Analytics.track', function(event) {
if ( 'conversion' === event.detail.Analytics.type ) {
dataLayer.push({
'event': 'gaTriggerEvent',
'gaEventCategory': 'form',
'gaEventAction': 'submit',
'gaEventLabel': 'optin-monster'
});
}
} );
@jtsternberg
jtsternberg / om.Analytics.track.js
Last active Nov 15, 2018 — forked from brianaohern/om-Analytics-conversion.js
Runs any time we are tracking an impression or conversion.
View om.Analytics.track.js
document.addEventListener('om.Analytics.track', function(event) {
// This event is passed the Campaign object
console.log(event.detail.Campaign);
// This event is passed the Analytics object
console.log(event.detail.Analytics);
} );
View om.Analytics.track-example.js
document.addEventListener('om.Analytics.track', function(event) {
if ( 'conversion' === event.detail.Analytics.type ) {
console.log(event.detail.Campaign.id + '-' + event.detail.Campaign.type + ' successfully tracked a conversion.');
} else {
console.log(event.detail.Campaign.id + '-' + event.detail.Campaign.type + ' successfully tracked an impression.');
}
} );
@jtsternberg
jtsternberg / om.Countdown.init.js
Created Nov 15, 2018
Runs when the campaign form HTML has been appended to the DOM and just before updating any countdown elements in the campaign.
View om.Countdown.init.js
document.addEventListener('om.Countdown.init', function(event) {
console.log(event.detail.Countdown);
console.log(event.detail.Campaign);
} );
You can’t perform that action at this time.