How to :: pass external variables to my embeds¶
Sometimes you may want to pass variables to your embed without having to declare them inside Toucan Toco because it depends on a specific context on your application.
To do so, you can pass down your variables in embeds scripts:
As you can see, you can add any key to our
variables parameter. If
you have to pass 2 parameters for instance, you’ll have to write:
In order to support
arraytype, we’re parsing each variables. Make sure you have encoded it well (ex: use JSON.stringify)
Setup in a story¶
After that, you can use your variables in the configuration of your
story. Thanks to
extraVariables you can template your variable
inside the story. For example, you can set a contextual
Now you’ve got an error because the variables aren’t interpolated !
Note that you can display a default value to avoid that state.
You should now have
default value interpolated.
We’ve got this: