SOLVED

Is it possible to cast Marketo variables with Javascript?

Go to solution
Anonymous
Not applicable

Is it possible to cast Marketo variables with Javascript?

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?

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Is it possible to cast Marketo variables with Javascript?

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Is it possible to cast Marketo variables with Javascript?

Wrap in quotes.

Anonymous
Not applicable

Re: Is it possible to cast Marketo variables with Javascript?

Perfect. Thanks!