Skip to content

Instantly share code, notes, and snippets.

View jtsternberg's full-sized avatar
😎
Awesome Motive-ing

Justin Sternberg jtsternberg

😎
Awesome Motive-ing
View GitHub Profile
@jtsternberg
jtsternberg / markdown.css
Last active June 30, 2018 22:42 — forked from imjasonh/markdown.css
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: #333;
cursor: default;
margin: 0;
padding: 0;
@jtsternberg
jtsternberg / customvariablefunction.html
Last active August 28, 2018 17:06 — forked from thomasgriffin/customvariablefunction.js
OptinMonster Dynamic Replacement API - function callback example.
<script type="text/javascript">
function OMCustomVariables(setCustom) {
setCustom('name', 'Thomas');
}
</script>
@jtsternberg
jtsternberg / variablefunctioncallback.html
Last active August 28, 2018 17:40 — forked from thomasgriffin/variablefunctioncallback.js
OptinMonster Dynamic Replacement API - variable function callback example.
<script type="text/javascript">
window.OMCustomVariables = function(setCustom) {
setCustom('name', 'Thomas');
};
</script>
@jtsternberg
jtsternberg / om.Campaign.normalize.js
Created November 15, 2018 18:08 — forked from brianaohern/om-Campaign-init.js
Runs just before any split test elements are normalized.
document.addEventListener('om.Campaign.normalize', function(event) {
console.log(event.detail.Campaign);
} );
@jtsternberg
jtsternberg / om.Action.window.js
Created November 15, 2018 19:20 — forked from brianaohern/om-Action-refresh.js
Runs before a new window is opened based on an action.
document.addEventListener('om.Action.window', function(event) {
// This event is passed the Campaign object
console.log(event.detail.Campaign);
// This event is passed the Action object
console.log(event.detail.Action);
} );
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.Analytics.track.js
Last active October 26, 2020 21:13 — forked from brianaohern/om-Analytics-conversion.js
Runs any time we are tracking an impression or conversion.
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);
} );
@jtsternberg
jtsternberg / om.Analytics.track-example.js
Last active November 15, 2018 19:56 — 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.
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 / setcustomvariable.js
Last active May 7, 2020 21:54 — forked from thomasgriffin/setcustomvariable.js
OptinMonster Dynamic Text Replacement API - setCustomVariable
<script type="text/javascript">
document.addEventListener('om.Dtr.init', function(event) {
/**
* API method for setting a custom variable. Must be accessed via the Dtr object.
*
* @param string $key The custom variable key to set.
* @param string $value The custom variable value to set for the key.
* @return null
*/
event.detail.Dtr.setCustomVariable('foo', 'bar');
@jtsternberg
jtsternberg / getcustomvariable.js
Last active May 7, 2020 21:50 — forked from thomasgriffin/getcustomvariable.js
OptinMonster Dynamic Text Replacement API - getCustomVariable
<script type="text/javascript">
document.addEventListener('om.Dtr.init', function(event) {
/**
* API method for retrieving a custom variable. Must be accessed via the app object.
*
* @param string $key The custom variable key to retrieve.
* @return string|bool The value of the custom variable key or false if not found.
*/
event.detail.Dtr.getCustomVariable('foo');
});