How Tos: Logic
How To: Run custom code when the Embeddable loads
Setting up pages, user data, analytics and more.
Adding a custom code Action to run when the embeddable first loads
1
Add a Trigger for on first load
- Open the Logic card.
- Switch to the Triggers tab.
- Add a new Trigger.
- Select
When "Flow" Is "Loaded"
.
2
Create a custom code Action
- Click “Create New Action”.
- Give it a name.
- Hit Apply.
3
Write your custom code
- Add whatever custom JS you like inside the
output()
function. - The first argument of
output()
is the User Data, and the other arguments are described here. - The code will execute on the frontend, in the main window environment, so has access to window functions and variables.
Learn more about Custom Code
Read more about writing Custom Code in Embeddables, including all the available arguments passed in to the function.