Storing partial user data in Embeddables
As described in the User Data guide, each user answer can be stored on three different levels:- Only in the context of the current page load (i.e. data is lost when the user refreshes or closes the tab).
- #1 and also in Local Storage in the user’s browser (i.e. the session is resumed when the user reloads the page again later).
- #1, #2 and also in Embeddables’ database (i.e. the data is also available for use in analytics in the Embeddables Web App).
Sending partial user data to your own backend
To send partial user data to your own backend, you can:- Add an Action with custom code that sends the data to your backend,
- Add a Trigger to execute that Action when the user reaches a key page or clicks an important button.
Instructions:
1
Create a custom code Action
- Go to the Logic sidebar and click on the Actions tab
- Click
+ Add New Action
- Give it a descriptive name like “Send Data to Backend”
- Hit
Add
2
Write your custom code
- Add code similar to the example below, which sends user data to your backend API:
3
Add Triggers for user events
- Switch to the Triggers tab
- Add a new Trigger
- Choose the event that should trigger sending data. For example:
WHEN Page IS Changed
to send data on every page changeWHEN Button KEY submit_button IS Clicked
to send on button click
- Select your “Send Data to Backend” Action
- Hit
Add
- Repeat for any other events you want to trigger the Action, e.g. all key milestone pages in your funnel
4
Test the integration
- Preview your Embeddable
- Open your browser’s developer tools to monitor network requests
- Verify that data is being sent to your backend when the triggers fire
- Check that the data structure matches what your backend expects
Learn more about Actions and Triggers
Read more about Actions and Triggers in Embeddables.
Learn more about Custom Code
Read more about writing Custom Code in Embeddables, including all the
available arguments passed in to the function.