Skip to content

Instantly share code, notes, and snippets.

@jtsternberg
Forked from thomasgriffin/hascustomvariable.js
Last active May 7, 2020 21:53
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 jtsternberg/71a6148262f63b5809c5bc3415279617 to your computer and use it in GitHub Desktop.
Save jtsternberg/71a6148262f63b5809c5bc3415279617 to your computer and use it in GitHub Desktop.
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');
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment