Skip to content

Releases: trysurface/scripts

Fix: Multiple input form triggers

Choose a tag to compare

@Redskull-127 Redskull-127 released this 11 Feb 07:18
f1fb30a
  • Fix multiple input (HTML) form triggers

Sync User Journey with Apex domains

Choose a tag to compare

@Redskull-127 Redskull-127 released this 09 Feb 20:36
47fde0f
  • Sync User Journey with Apex domains

Add support for User Journey Tracking

Choose a tag to compare

@Redskull-127 Redskull-127 released this 22 Jan 21:54
6d284a0
  • Add support for User Journey Tracking

Component pre-filling enhancements

Choose a tag to compare

@Redskull-127 Redskull-127 released this 19 Jan 20:22
b68d29c
  • 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

Choose a tag to compare

@Redskull-127 Redskull-127 released this 15 Jan 16:45
f16e8a6
  • This PR reverts the user journey

Fix: Cookie Size Limit

Choose a tag to compare

@Redskull-127 Redskull-127 released this 15 Jan 15:35
7e72ad7
  • 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

Choose a tag to compare

@Redskull-127 Redskull-127 released this 14 Jan 17:17
8af3cb5
  • User journey tracking for form response submissions

Surface tag SPA support

Choose a tag to compare

@Redskull-127 Redskull-127 released this 08 Jan 15:20
52f7ccf
  • Refactor input-trigger form initialization

Surface Tag Enhancements

Choose a tag to compare

@Redskull-127 Redskull-127 released this 30 Dec 15:32
44388c0

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>

Add support for ID selector

Choose a tag to compare

@Redskull-127 Redskull-127 released this 09 Dec 10:59
0a67bea
  • Added support for ID selector on any DOM element.
    <script>
      (function () {
        const surface_src =
          "https://forms.withsurface.com/s/<FORM_ID_HERE>";
        const surface_embed_type = "popup";
        const target_element_class = "surface-form-button";
        const c = new SurfaceEmbed(
          surface_src,
          surface_embed_type,
          target_element_class,
          {
            enforceIDSelector: true // setting this true will enforce the ID selectors (default and fallback is false always)
          }
        );
      })();
    </script>