Releases: trysurface/scripts
Releases · trysurface/scripts
Increasing user journey tracking window
- Increasing user journey tracking window to 60 days (sliding window)
Fix: Multiple input form triggers
- Fix multiple input (HTML) form triggers
Sync User Journey with Apex domains
- Sync User Journey with Apex domains
Add support for User Journey Tracking
- Add support for User Journey Tracking
Component pre-filling enhancements
- Added support for pre-filling all the available components such as short input, long input, dropdown, mcq and identity info
<form class="surface-form-handler">
<input type="email" name="email" placeholder="Email" />
<input type="text" name="firstName" data-field-name="firstName" placeholder="First Name" />
<input type="text" name="lastName" data-field-name="lastName" placeholder="Last Name" />
<!-- select your last name -->
<select name="dropdown" data-question-id="uuhXULyYOorp">
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
<option value="option3">Option 3</option>
</select>
<label for="mcq">Multiple Choice Question</label>
<select name="mcq" data-question-id="rpyUMgLUXiPO" multiple>
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
<option value="option3">Option 3</option>
</select>
<!-- textarea question -->
<label for="textarea">Textarea Question</label>
<textarea name="textarea" data-question-id="zMBaYsxGNIxz"></textarea>
<input type="submit" value="Submit" />
</form>Revert User Journey
- This PR reverts the user journey
Fix: Cookie Size Limit
- Fixes the cookie size limit; restricts by default to 15 visits. However, users can still customize the limit:
<!-- Start Surface Tag -->
<script
data-max-page-visits="10"
src="surface_tag.js" site-id="xxx"></script>
<!-- End Surface Tag -->User journey tracking
- User journey tracking for form response submissions
Surface tag SPA support
- Refactor input-trigger form initialization
Surface Tag Enhancements
Changes
New preload Option
- Introduced a new
preloadconfiguration option with three modes:"true"(default): Preloads iframe during browser idle time usingrequestIdleCallback(withsetTimeoutfallback)"pageLoad": Preloads iframe immediately on page load"false": Disables preloading entirely
Preload Logic
- Added
preloadIframe()method that intelligently schedules iframe initialization - Uses
requestIdleCallbackwith a 3-second timeout for non-blocking preload - Falls back to
setTimeoutfor browsers withoutrequestIdleCallbacksupport
Iframe Caching Improvements
- Added
_iframePreloadedflag to track preload completion state - Improved cache handling to avoid unnecessary iframe reloads when options match
- If iframe is still loading during popup/slideover open, sets up onload handler without resetting
src
Bug Fix
- Fixed invalid CSS: changed
display: hiddentodisplay: nonefor.close-btn-container
Other Additions
- Pressing
escwill close the Surface form - Speed up the animation of both popup and slideover form
Usage
<script data-question-id="ZpntedGGuSBd">
(function () {
const surface_src =
"https://forms.withsurface.com/s/cmjh96qih0090l70bnp9bzaar";
const surface_embed_type = "slideover";
const target_element_class = "surface-form-button";
const c = new SurfaceEmbed(
surface_src,
surface_embed_type,
target_element_class,
{ preload: "true" } // can be "true", "false", "pageLoad" and default is "true"
);
})();
</script>