Skip to content

Instantly share code, notes, and snippets.

@ericakfranz
Last active June 27, 2023 20:06
Show Gist options
  • Save ericakfranz/d9d450e9807b1ca6ff2390426c04334a to your computer and use it in GitHub Desktop.
Save ericakfranz/d9d450e9807b1ca6ff2390426c04334a to your computer and use it in GitHub Desktop.
OptinMonster Custom Smart Tag to capture all query args.
const queryString = window.location.search; // capture all query args
document.addEventListener('om.Dtr.init', function(event) {
// use this event instead if added directly through the OM campaign builder
// document.addEventListener('om.Campaign.load', function(event) {
// Registers {{query_args}} smart tag that outputs all query args from the current page.
event.detail.Dtr.setCustomVariable('query_args', queryString);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment