Is it possible to cast Marketo variables with Javascript? | Community
Skip to main content
May 26, 2016
Solved

Is it possible to cast Marketo variables with Javascript?

  • May 26, 2016
  • 1 reply
  • 1475 views

Is it possible to cast the value of a Marketo template variable (e.g., ${var1}) into an object type that can be used in Javascript? A simple example would be trying to output the value of ${var1} to the console:

<script>

      console.log(${var1});

</script>

Given that var1 has been defined in the <head>:

<meta class="mktoString" mktoName="Variable 1" id="var1" default="This is a variable">

... the console errors out because ${var1} is translated into This is a variable, but not as a string.

Any ideas if/how this can be done?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

Wrap in quotes.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
May 26, 2016

Wrap in quotes.

May 26, 2016

Perfect. Thanks!