Skip to content

Releases: trysurface/scripts

Increasing user journey tracking window

25 Feb 13:09
b239ee4

Choose a tag to compare

  • Increasing user journey tracking window to 60 days (sliding window)

Fix: Multiple input form triggers

11 Feb 07:18
f1fb30a

Choose a tag to compare

  • Fix multiple input (HTML) form triggers

Sync User Journey with Apex domains

09 Feb 20:36
47fde0f

Choose a tag to compare

  • Sync User Journey with Apex domains

Add support for User Journey Tracking

22 Jan 21:54
6d284a0

Choose a tag to compare

  • Add support for User Journey Tracking

Component pre-filling enhancements

19 Jan 20:22
b68d29c

Choose a tag to compare

  • 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

15 Jan 16:45
f16e8a6

Choose a tag to compare

  • This PR reverts the user journey

Fix: Cookie Size Limit

15 Jan 15:35
7e72ad7

Choose a tag to compare

  • 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

14 Jan 17:17
8af3cb5

Choose a tag to compare

  • User journey tracking for form response submissions

Surface tag SPA support

08 Jan 15:20
52f7ccf

Choose a tag to compare

  • Refactor input-trigger form initialization

Surface Tag Enhancements

30 Dec 15:32
44388c0

Choose a tag to compare

Changes

New preload Option

  • Introduced a new preload configuration option with three modes:
    • "true" (default): Preloads iframe during browser idle time using requestIdleCallback (with setTimeout fallback)
    • "pageLoad": Preloads iframe immediately on page load
    • "false": Disables preloading entirely

Preload Logic

  • Added preloadIframe() method that intelligently schedules iframe initialization
  • Uses requestIdleCallback with a 3-second timeout for non-blocking preload
  • Falls back to setTimeout for browsers without requestIdleCallback support

Iframe Caching Improvements

  • Added _iframePreloaded flag 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: hidden to display: none for .close-btn-container

Other Additions

  • Pressing esc will 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>