How to Inject User/Sub Account Properties in Iframes on Sub Account Dashboards
You can now enhance your Stack dashboard by embedding dynamic content using iframes. This guide will walk you through the process of injecting user or sub-account properties into your iframes.
Steps to Embed Dynamic Content
Step 1: Enter Edit Mode
Begin by opening your Sub Account Dashboard. Switch to Edit mode to start customizing your dashboard.
Step 2: Navigate to the Objects Tab
Once you're in Edit mode, locate and click on the Objects section.
Step 3: Choose Embed
From the Objects menu, select the Embed option to proceed with embedding content.
Step 4: Enter the URL
Input the URL of the content you wish to embed into your dashboard. This will serve as the source for your iframe.
Step 5: Add Parameters
After entering the URL, you can add specific parameters to tailor the embedded content to your needs.
Step 6: Utilize Dynamic User Properties
To make your embedded content dynamic, you can inject sub-account or user identifiers directly into the iframe source. Use placeholders such as {{location.id}} or {{location.name}} within your URL to achieve this flexibility.
For instance, you can create a dynamic URL like this:
https://app.stack.com/v2/location/`{{location.id}}`/conversations
This URL can be embedded as an iframe on your dashboard, allowing it to dynamically adjust based on the sub-account or user.
Supported User Properties
Stack supports various user properties that can be included in your URL. Replace the userpropertyhere in {{user.userpropertyhere}} with any of the following:
- companyId
- phone
- role
- type
- firstName
- lastName
- name
- fullName
For example, to pass a user's first name in the URL, you could use:
https://yourwebsiteurlhere.com/?user=`{{user.firstName}}`
Utilize these steps and properties to create a personalized and dynamic experience on your Stack dashboard.