Embeddable Elements
Embedded elements can be quickly inserted into your webpage or web app. They allow your users to view their referral links without having to sign in as an extra step.
What are embeddable elements?
Embeddable elements are one-line-of-code inline block elements that you can insert into your web app for a whitelabel referral portal experience for your signed-in users.
Embeddable elements can be inserted into any webpage and can be customized using HTML data attributes.
Want to change basic styles? Login to GrowSurf and navigate to Edit Campaign > 2. Design > Theme. Or use data attributes to apply style overrides.
Embeddable elements have two UI states that display differently to New Visitors ("no auth" state) and to Participants ("auth" state)
Important Notes:
You must have the GrowSurf Universal Code installed within the same webpage that you are using embeddable elements on.
If you see the "no auth" state when you are expecting to see the "auth" state, it may be because participant authentication is enabled for your campaign and there may not be a saved cookie already on the participant's browser. Please see this article for more details.
If you don't see styles applied to embedded elements, please check your browser developer console for errors/warnings. Data attributes must be parsable by the
JSON.parse()
function.
(Optional) Forcefully re-rendering embeddable elements
Although embedded elements listen for changes in data attributes and update dynamically, if you run into issues where the embedded elements do not render/refresh, you can force re-rendering. This may be useful if you are working with dynamic data (such as as setting data-grsf-email
to the user's email in the Embedded Form).
To force re-rendering, call growsurf.initElements()
, which destroys all embeddable elements in the DOM and forces GrowSurf to re-render them.
Please make sure to wait for the GrowSurf Universal Code to load by using the grsfReady
event listener. See an example here.
For single-page applications (SPAs), there may be issues with embeddable elements rendering on the page due to how URL routes are handled. In this case, calling growsurf.initElements()
may not work and you will need to call growsurf.init()
to re-initialize GrowSurf to make the embeddable elements render.
Embedded Form
The embedded form is an element that has two different UI states.
For new visitors, the signup form is shown (this is the "no auth" state).
For participants, their unique referral link with share buttons are displayed (this is the "auth" state).
Example usage:
This is the bare minimum code required to display this element.
Data attributes:
HTML Attribute | Data Type | Description |
| N/A | (Required) This attribute turns any HTML element into an embedded form. |
| String | (Optional) If provided with a valid email address, a new participant will be created, or an existing participant will be returned — and their unique referral link and social share buttons will be displayed. |
| String | (Optional) If provided with If the participant already exists in the referral campaign, then this attribute will be ignored. |
| String | (Optional) If provided with If the participant already exists in the referral campaign, then this attribute will be ignored. |
| Object | (Optional) If provided with If the participant already exists in the referral campaign, then this attribute will be ignored. |
| Object | (Optional) Adds inline styles to the GDPR consent paragraph text (if GDPR enabled). |
| Object | (Optional) Adds inline styles to the GDPR consent checkbox text (if GDPR is enabled). |
| Object | (Optional) Adds inline styles to the form input labels. |
| Object | (Optional) Adds inline styles to any button elements. |
| Object | (Optional) Adds custom styles to any link elements. |
| String | (Optional) Sets the label text for the targeted input field. Replace
Example:
Custom fields are supported, so if you have an input field called "Phone Number", you would set |
| String | (Optional) Sets the placeholder text for the targeted input field. Replace
Example:
Custom fields are supported, so if you have an input field called "Phone Number", you would set |
| Object | (Optional) Adds inline styles to the targeted social share button. Replace Example: |
| String | (Optional) Sets the text of the targeted social share button. Replace Example: |
| String | (Optional) Sets the pre-populated message of the targeted social share button.
Replace
Example: To change the subject line for email messages, set |
| String | (Optional) Sets the text of the share instructions (these instructions are only visible when the participant is in the auth state). |
| Object | (Optional) Adds inline styles to the share instructions. |
| String | (Optional) Sets the text of the 'Copy Link' button. |
| Object | (Optional) Adds inline styles to the container of the input box and Copy Link button. |
| String | (Optional) Redirects to the given URL upon form submission |
Embedded Invite
The embedded invite is an element that lets a participant send a bulk email invite to their friends/family.
Example usage:
This is the bare minimum code required to display this element.
Data attributes:
HTML Attribute | Data Type | Description |
| N/A | (Required) This attribute turns any HTML element into an embedded invite. |
| String | (Optional) The email of the participant to display the invite element for. If the participant does not yet exist within the campaign, they will be newly added. |
| String | (Optional) Sets the text of the invite instructions. |
| Object | (Optional) Adds inline styles to the invite instructions. |
| Object | (Optional) Adds inline styles to the form input labels. |
| String | (Optional) Sets the placeholder text of the email address input field. |
| String | (Optional) Sets the text of the preview link. If no value is provided, the button text will default to the GrowSurf window invite preview link text. |
| String | (Optional) Sets the label text for the email subject line in the preview section. |
| String | (Optional) Sets the placeholder text for the email subject line in the preview section. |
| String | (Optional) Sets the pre-populated value for the email subject line in the preview section. |
| String | (Optional) Sets the label text for the email message body in the preview section. |
| String | (Optional) Sets the placeholder text for the email message body in the preview section. |
| String | (Optional) Sets the pre-populated value for the email message body in the preview section. Include |
| Object | (Optional) Adds inline styles to any link elements. If no value is provided, the link styles will inherit from the GrowSurf window link styles. |
| String | (Optional) Sets the text of the submit button. If no value is provided, the button text will default to the GrowSurf window invite submit button text. |
| Object | (Optional) Adds inline styles to any button elements. If no value is provided, the button styles will inherit from the GrowSurf window button styles. |
| Object | (Optional) Adds custom styles to the contact pills, which appear underneath the email address input field when email addresses have been entered. If no value is provided, the button styles will inherit from the GrowSurf window contact pill styles. |
| Object | (Optional) Adds inline styles to the targeted address book button. If no value is provided, the button styles will inherit from the GrowSurf window button styles. Replace Example: |
| String | (Optional) Sets the text of the targeted address book button. If no value is provided, the button text will default to the GrowSurf window invite Google Contacts button text. Replace Example: |
| String | (Optional) Sets the "Search" text in the contact picker. |
| String | (Optional) Sets the "Suggestions" text in the contact picker. |
| String | (Optional) Sets the "Results" text in the contact picker. |
| String | (Optional) Sets the "Load More" button text in the contact picker. |
Embedded Button
The embedded button is an element that opens up the GrowSurf window when clicked.
Example usage:
This is the bare minimum code required to display this element.
Data attributes:
HTML Attribute | Data Type | Description |
| N/A | (Required) This attribute turns any HTML element into an embedded button. |
| String | (Optional) The email of the participant to display the button element for. If the participant does not yet exist within the campaign, they will be newly added. |
| String | (Optional) Sets the text of the embedded button. If no value is provided, the button text will default to the GrowSurf window signup form button text. |
| Object | (Optional) Adds inline styles to the button. If no value is provided, the button styles will inherit from the GrowSurf window button styles. |
Embedded Leaderboard
The embedded leaderboard is an element that has two different UI states.
For new visitors, the leaderboard is displayed (this is the "no auth" state).
For participants, the leaderboard is displayed with their row highlighted (this is the "auth" state).
Example usage:
This is the bare minimum code required to display this element.
Data attributes:
HTML Attribute | Data Type | Description |
| N/A | (Required) This attribute turns any HTML element into an embedded leaderboard. |
| String | (Optional) The email of the participant to display the leaderboard element for. If the participant does not yet exist within the campaign, they will be newly added. |
| Object | (Optional) Adds inline styles to any buttons within the leaderboard. |
| Object | (Optional) Adds custom styles to any link elements within the embedded leaderboard. |
| String | (Optional) Sets the text of the title above the leaderboard. |
| Object | (Optional) Adds inline styles to the text of the title above the leaderboard. |
| String | (Optional) Sets the text of the rank column header. |
| String | (Optional) Sets the text of the participants column header. |
| Object | (Optional) Adds inline styles to the winner icon that is displayed next to the winner. |
| Object | (Optional) Adds inline styles to the header that is displayed above the leaderboard list. |
| Object | (Optional) Adds inline styles to the list items that are displayed within the leaderboard list. |
Embedded Rewards
The embedded rewards is an element that has two different UI states.
For new visitors, the campaign rewards are displayed (this is the "no auth" state).
For participants, the campaign rewards are displayed with the participant's progress being displayed next to each one (this is the "auth" state).
Example usage:
This is the bare minimum code required to display this element.
Data attributes:
HTML Attribute | Data Type | Description |
| N/A | (Required) This attribute turns any HTML element into embedded rewards. |
| String | (Optional) The email of the participant to display the rewards element for. If the participant does not yet exist within the campaign, they will be newly added. |
| Object | (Optional) Adds custom styles to the reward card(s). |
| Object | (Optional) Adds custom styles to the reward title. |
| Boolean | (Optional) Displays the rewards in a horizontal format. |
| Boolean | (Optional) If |
| String | (Optional) Sets the "required referrals" text. This is the text that is used to indicate the number of referrals a participant must make in order to earn the reward. NOTE This element only displays for non-Leaderboard reward types. |
| Object | (Optional) Adds custom inline styling to the "required referrals" tag displayed for non Leaderboard reward types. This is the element within the reward that is used to indicate the number of referrals a participant must make in order to earn the reward. |
| String | (Optional) Updates the "top referrers" text displayed for Leaderboard reward types. This is the text that is used to indicate the reward goal for Leaderboard type rewards. NOTE This element only displays for Leaderboard reward types |
| Object | (Optional) Adds custom styling to the "top referrers" tag. This is the element within the Leaderboard reward that is used to indicate the rank threshold the participant must reach in order to earn the reward. |
| String | (Optional) Updates the "max per referrer" text displayed within the reward. |
| String | (Optional) Updates the "per month" text displayed within the reward. |
| String | (Optional) Adds inline styling for the "max per referrer" text and/or "per month" text displayed within the reward. |
| Object | (Optional) Updates the inline styling of the progress icon style used to display the progress the participant has made in order to achieve the reward goal. NOTE Only |
| Number | (Optional) Updates the max number of progress icons to display. |
| String | (Optional) Adds inline styles to the footer text messages (e.g, "manual approval" footer text, "max rewards shown" footer text). |
Embedded Stats
The embedded stats is an element that displays a participant's referral statistics and rank.
The referral count text ("X referrals made") will only be displayed if you have at least one non-Leaderboard-type reward
The rank text ("#X your rank") will only be displayed if you have at least one Leaderboard-type reward
Example usage:
This is the bare minimum code required to display this element.
Data attributes:
HTML Attribute | Data Type | Description |
| N/A | (Required) This attribute turns any HTML element into embedded stats |
| String | (Optional) The email of the participant to display stats for. If the participant does not yet exist within the campaign, they will be newly added. |
| Object | (Optional) Adds inline styling to the element that displays the participant's referral count. |
| String | (Optional) Sets the text that is used to label the participant's referral count. |
| Object | (Optional) Adds inline styling to the element that displays the participant's rank. |
| String | (Optional) Sets the text that labels the participant's rank. |
Embedded Next Milestone
The embedded next milestone is an element that displays how many referrals a participant needs to make to unlock the next/upcoming milestone reward (only applies to milestone rewards).
In the Campaign Editor, make sure to update your milestone reward's advanced settings to set the Next Milestone prefix and suffix values (see image).
If the participant has reached all milestones, then nothing will be rendered
Example usage:
This is the bare minimum code required to display this element.
Data attributes:
HTML Attribute | Data Type | Description |
| N/A | (Required) This attribute turns any HTML element into an embedded next milestone |
| Array<Object> | (Optional) Set this attribute if you want to override your campaign's milestone rewards so that you can define your own milestone rewards as an Array. Each Object should follow this format:
The following is an example Object:
|
| String | (Optional) The email of the participant to display their next milestone reward to. If the participant does not yet exist within the campaign, they will be newly added. |
| Boolean | (Optional) If set to |
Embedded Referral Status
The embedded referral status lets a participant view the individual progress of their referrals and email invitees.
For email invitees, if they have not yet signed up, their email address will display as obfuscated
Example usage:
This is the bare minimum code required to display this element.
Data attributes:
HTML Attribute | Data Type | Description |
| N/A | (Required) This attribute turns any HTML element into an embedded referral status element. |
| String | (Optional) The email of the participant to display the referral status element for. If the participant does not yet exist within the campaign, they will be newly added. |
| Object | (Optional) Adds inline styles to any buttons within the referral status element. |
| Object | (Optional) Adds custom styles to any link elements within the embedded referral status element. |
| String | (Optional) Sets the text of the title above the referral status list. |
| Object | (Optional) Adds inline styles to the text of the title above the referral status list. |
| String | (Optional) Sets the text of the Status column header. |
| String | (Optional) Sets the text of the Your Referral column header. |
| Object | (Optional) Adds inline styles to the header that is displayed above the referrals list. |
| Object | (Optional) Adds inline styles to the list items that are displayed within the referrals list. |
Last updated