Skip to content

Releases: trysurface/scripts

Page element tracker system for Surface CMS

Choose a tag to compare

@Redskull-127 Redskull-127 released this 29 Jun 19:33
f874915

Includes:

  • feat: bundle the Surface CMS review bridge into the tag #66

Fix Race condition due to : Query params based trigger to open surface forms

Choose a tag to compare

@paragmore paragmore released this 09 Jun 15:22
75118a3

What's Changed

  • fix(open-trigger): reuse same-mode embed exactly, else isolated overlay (honors configured mode) by @paragmore in #65

Full Changelog: v1.0.1...v1.1.2

Query params based trigger to open surface forms

Choose a tag to compare

@paragmore paragmore released this 09 Jun 13:32
76fb448

What's Changed

  • SURF-1081 feat(open-trigger): auto-open a form from a URL query-param (edge map) by @paragmore in #64

Full Changelog: 1.1.0...v1.1.1

Content Analytics Tracking

Choose a tag to compare

@AminHakem AminHakem released this 29 May 20:10
d08fe3b

Release Notes — Surface Tag

PR: #63 — feat(content-analytics): include environment in track metadata

Features

  • Environment ID in pageview tracking — the user journey /api/v1/lead/track payload now includes environmentId in its metadata for both initial pageviews and SPA route-change pageviews. This lets the Surface Forms backend (Content Analytics) aggregate pageviews per environment.
  • The environment id is resolved once at startup from the <script> tag (getSiteIdFromScript) and threaded through SurfaceStoreinitializeUserJourneyTracking / updateUserJourneyOnRouteChange.

How it works

  • src/index.ts now reads the environment id up front, calls setEnvironmentId(...), and passes it into new SurfaceStore(environmentId). The previous IIFE auto-init block was folded into this top-level initialization — same behavior, no duplicate getSiteIdFromScript/setEnvironmentId call.
  • SurfaceStore stores the id as this.environmentId (constructor param defaults to null for backwards compatibility) and forwards it to both journey-tracking calls.
  • environmentId is spread into metadata only when present (...(environmentId ? { environmentId } : {})), so payloads are unchanged when no id is available. Existing surfaceLeadData fields are preserved.

Scope (intentionally not included)

  • No new endpoint, no new pageview module, no forced identify calls, and no new route observers. This reuses the existing /lead/track pageview path the track endpoint already receives.

Build

  • Rebuilt surface_tag.js and its synced copy surface_embed_v1.js. (Bundler-internal variable renames like environmentId2environmentId3 are cosmetic and have no runtime effect.)

Unchanged

  • CDN URL, <script> tag API, public window API, and the PostMessage protocol.

Verification

  • pnpm install, pnpm typecheck, and pnpm build all pass.

Surface Tag Modularization

Choose a tag to compare

@Redskull-127 Redskull-127 released this 11 May 01:00
4d53ce4

Release Notes — Surface Tag

PR: #60 — SURF-680: Modularize surface_tag.js into TypeScript

Refactor

  • Modularized surface_tag.js — the monolithic 2431-line script is now 40 TypeScript modules under src/, bundled by esbuild into the same single-file IIFE. No changes to the public API or CDN URLnew SurfaceEmbed(...), new SurfaceExternalForm(...), and SurfaceTagStore work identically.
  • Output is 62.9KB uncompressed (down from ~73KB after DRY consolidation); ~9.8KB minified+gzipped via jsdelivr (unchanged).

Bug fixes

  • HTTPS enforcement — non-HTTPS iframe URLs were logged but loaded anyway; they're now blocked.
  • Listener stacking on SPA navigationinitializeMessageListener was re-called on every route change, stacking duplicate window.addEventListener("message") handlers. Fixed.
  • Input mutationensureDefault() was mutating the user-provided responsive embed-type config object; it now returns a new object.
  • Cookie maxAge default — cookie handling now uses nullish coalescing so the default maxAge is applied correctly when 0 or falsy values are passed.

Developer experience

  • TypeScript with strict mode and full type definitions.
  • pnpm run build / pnpm run dev / pnpm run typecheck (esbuild, ~10ms builds).
  • Postbuild step automatically syncs surface_tag.jssurface_embed_v1.js.
  • Structured logging across all modules ({ prefix, message, response }).
  • Shared utilities replace duplicated route observer, beacon, logger, and cookie code across Store/Embed/ExternalForm.

Unchanged

  • CDN URL (jsdelivr.net/gh/trysurface/scripts@latest/surface_tag.min.js)
  • <script> tag API
  • PostMessage protocol (STORE_UPDATE, LEAD_DATA_UPDATE, SEND_DATA)
  • surface_tracking.js and legacy customer scripts

Verification

19/19 manual + Playwright tests passing across static pages and a Next.js App Router SPA (popup, slideover, inline, input-trigger, SPA navigation, user journey tracking, postMessage protocol).

v0.1.45

Choose a tag to compare

@Redskull-127 Redskull-127 released this 09 Apr 16:50
dcb0a94

Includes:

  • Removes website de-anon from tag.

Support tabbing in embeds

Choose a tag to compare

@Redskull-127 Redskull-127 released this 24 Mar 10:12
c82c3d6

Includes

  • Support tabbing in embeds

Increasing user journey tracking window

Choose a tag to compare

@Redskull-127 Redskull-127 released this 25 Feb 13:09
b239ee4
  • Increasing user journey tracking window to 60 days (sliding window)

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