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 / getcustomvariables.js
Last active May 7, 2020 21:53 — forked from thomasgriffin/getcustomvariables.js
OptinMonster Dynamic Text Replacement API - getCustomVariables
<script type="text/javascript">
document.addEventListener('om.Dtr.init', function(event) {
/**
* API method for retrieving all custom variables. Must be accessed via the Dtr object.
*
* @return object A JavaScript object with key/value pairs for custom variables.
*/
event.detail.Dtr.getCustomVariables();
});
</script>
@jtsternberg
jtsternberg / hascustomvariable.js
Last active May 7, 2020 21:53 — forked from thomasgriffin/hascustomvariable.js
OptinMonster Dynamic Text Replacement API - hasCustomVariable
<script type="text/javascript">
document.addEventListener('om.Dtr.init', function(event) {
/**
* API method for checking if a custom variable has been registered.
* Must be accessed via the Dtr object.
*
* @param string $key The custom variable key to check.
* @return bool True if the custom variable exists, false otherwise.
*/
event.detail.Dtr.hasCustomVariable('foo');
@jtsternberg
jtsternberg / hascustomvariables.js
Last active May 7, 2020 21:53 — forked from thomasgriffin/hascustomvariables.js
OptinMonster Dynamic Text Replacement API - hasCustomVariables
<script type="text/javascript">
document.addEventListener('om.Dtr.init', function(event) {
/**
* API method for checking whether there are any custom variables set.
* Must be accessed via the Dtr object.
*
* @return bool True if any custom variable has been registered, false otherwise.
*/
event.detail.Dtr.hasCustomVariables();
});
@jtsternberg
jtsternberg / deletecustomvariable.js
Last active May 7, 2020 21:54 — forked from thomasgriffin/deletecustomvariable.js
OptinMonster Dynamic Text Replacement API - deleteCustomVariable
<script type="text/javascript">
document.addEventListener('om.Dtr.init', function(event) {
/**
* API method for deleting a custom variable. Must be accessed via the Dtr object.
*
* @param string $key The custom variable to delete.
* @return null
*/
event.detail.Dtr.deleteCustomVariable('foo');
});