Skip to content
Pitchlane API

Guide

Landing page SDK v1

Author a single HTML page with a styleable Pitchlane video player. Find lifecycle events, playback cues, public variables and tracking contracts.

This reference applies when Page Templates or Video page hosting is enabled for your account. It does not replace the standard campaign landing-page settings. For a Pitchlane-hosted template, use your Pitchlane MCP agent to create or edit one HTML file with CSS, JavaScript and Liquid. Do not include the SDK script: the viewer inserts the immutable build pinned to that template. For a page on your CMS, use the website installation guide instead. These are alternative campaign destinations.

Contract v1. Download the typed browser API or read the machine-readable reference. For a pinned SDK, use the reference and declarations packaged with that build. The release’s downloads.<build>.json metadata lists the exact download names and SHA-256 hashes. Each download is named by its own bytes and identifies the SDK script’s build.

Start with a working template

<!doctype html>
<html lang="{{ page.locale }}">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>{{ video.title | default: "A personal video" }}</title>
  <style>
    main { max-width: 52rem; margin: 5vh auto; padding: 1rem; font: 1.125rem/1.5 system-ui; }
    [data-pitchlane-player] { --pl-accent: #6441a5; --pl-control-radius: .5rem; }
  </style>
</head>
<body>
  <main>
    <h1>A video for {{ commonData.firstName | default: "you" }}</h1>
    {% if commonData.companyName != blank %}
      <p>Made for {{ commonData.companyName }}.</p>
    {% endif %}
    <div data-pitchlane-player></div>
  </main>
</body>
</html>

Keep exactly one player mount on every Liquid branch. The player lives in the page, not in a Pitchlane iframe. Style its light DOM with the hooks above; leave the native media element and controls in place. The SDK handles fallback media, playback and measurement.

Add this before the closing body tag. Register directly; no connect call, DOMContentLoaded listener or polling. For a mandatory booking path, keep an always-visible fallback: a five-second video will never reach 30 seconds.

<p id="schedule" hidden><a href="https://example.com/book">Book a call</a></p>
<script>
  pitchlane.on("player:cue", { at: 30 }, () => {
    document.getElementById("schedule").hidden = false;
  });
</script>

A cue is about position, not proof of watching. A seek from 10s to 50s can reveal content. Analytics Reached is the furthest endpoint actually played in this visit: play 0–10s and 50–55s of a 60s video and Reached is 55s (92%), not 15s. Seeking without playing is not evidence.

Methods and events

  • pitchlane.setAnalyticsConsent() — Grant or deny measurement. Does not affect playback or override URL DNT.
  • pitchlane.track() — Report only an allowed semantic event and its exact details; never a provider payload.
  • pitchlane.getContext() — One frozen public context per navigation; null until ready.
  • pitchlane.bind() — Fill marked leaf text in newly inserted CMS markup; no HTML insertion or new session.
  • pitchlane.getState() — Read current readiness, media seconds/duration and last error. Times may be null.
  • pitchlane.player — Controls for this page’s Pitchlane player, not the raw Video.js instance.
  • pitchlane.on() — Subscribe immediately after the SDK script. Returns a function to unsubscribe.
  • pitchlane.player.mount() — Mount in a selector or HTMLElement after ready. Repeating the same mount is harmless.
  • pitchlane.player.unmount() — Remove the Pitchlane-owned player; do this before mounting in a different host.
  • pitchlane.player.play() — Play after metadata is ready. Handle the promise: browsers can refuse autoplay.
  • pitchlane.player.pause() — Pause after metadata is ready.
  • pitchlane.player.seek() — Seek to finite seconds between zero and the current duration, inclusive.

Every on returns an unsubscribe function. Only readiness and cues are remembered; use getState() rather than waiting for another pause to learn the current media state.

  • error — A bounded player/SDK failure. Use getState() for the last error. Callback: { scope: "player" | "sdk", code: string, message: string }.
  • player:cue — Supply {at: seconds}. Fires once per subscription on playback or completed seek at or past that point, including late registration. A rewind does not rearm it. Callback: { at: number, currentTime: number }.
  • player:ended — Playback ended. Future events only. Callback: { currentTime: number }.
  • player:pause — Playback paused. Future events only. Callback: { currentTime: number }.
  • player:play — Playback started, resumed or replayed. Future events only. Callback: { currentTime: number, reason: "replay" | "resume" | "start" }.
  • player:ready — First usable media metadata (duration in seconds); remembered for late subscribers. Callback: { duration: number }.
  • player:timeupdate — Local playhead and duration in seconds, at most four updates per second. Not analytics. Callback: { currentTime: number, duration: number }.
  • ready — DOM and recipient context are ready. A late subscriber is called once on a microtask. Callback: no payload.

Public template variables

Field Kind Nullable
video.id text no
video.shortId text no
video.title text yes
video.videoUrl https no
video.posterImageUrl https yes
video.createdAt instant no
video.renderedAt instant yes
page.locale language no
commonData.firstName text yes
commonData.lastName text yes
commonData.email text yes
commonData.companyName text yes
commonData.website text yes
commonData.linkedinUrl text yes

video.id is the record ID. video.shortId goes in recipient URLs. video.title is independent of the lead-field picker and can include a prospect’s first name. Review titles even if you expose no lead fields. Only exposed schema keys appear in leadData. For keys with spaces, use literal brackets, as in {{ leadData["Offer name"] | default: "a demo" }}. Standard aliases come from the matching exposed lead fields and can be blank. Give nullable text a fallback. In JavaScript, a missing key returns undefined and a present but blank field returns null.

Template values are escaped. The compiler accepts these output contexts:

  • HTML text.
  • Whole or partial values in these quoted text attributes: title, alt, aria-label, aria-description, placeholder.
  • The whole quoted html[lang] value, using a field of kind language.
  • The whole quoted a[href] value, using a field of kind HTTPS.
  • The whole quoted img[src] value, using a field of kind HTTPS.

Read pitchlane.getContext() in a ready callback for JavaScript behavior. Use textContent to insert visitor text.

Tracking and calendar recipes

Local SDK subscriptions never enable analytics. The SDK automatically observes eligible trusted link and button clicks, excluding the player, fields and forms. Use data-pl-no-track to exclude a subtree. On your own website mark an explicit data-pl-track-clicks area. A page click is not a conversion; report the semantic action only when it actually happens.

  • cta_click — Intentional CTA activation, not every link click. Details: { slot: "primary" | "secondary" }.
  • calendar_step — Calendly funnel step; not a booking. Details: { provider: "calendly", step: "event_type_viewed" | "profile_viewed" | "time_selected" }.
  • calendar_booking — Report only the provider’s scheduled event. Pitchlane treats a booking as human activity; it can release held views and trigger subscribed webhooks. Details: { provider: "calendly" | "savvycal" }.

The SDK does not mount a calendar. Paste one matching provider recipe, replace the example link everywhere, and keep the fallback link. Send no invitee details or event URLs. Provider steps are not interchangeable with bookings. Reporting a booking does not enable new webhook subscriptions.

Calendly

<!-- Replace both example scheduling URLs with the customer's Calendly link. -->
<a href="https://calendly.com/example/intro">Open scheduling page</a>
<div id="calendar" style="width:100%;max-width:100%;overflow:hidden"></div>
<script src="https://assets.calendly.com/assets/external/widget.js"></script>
<script>
  pitchlane.on("ready", () => {
    const parentElement = document.querySelector("#calendar");
    // The inline widget needs 320 CSS pixels inside the page, not just on the device.
    if (!parentElement || !window.Calendly || parentElement.clientWidth < 320) return;
    const reported = new Set();
    function onMessage(event) {
      if (!parentElement.isConnected) return;
      const frame = parentElement.querySelector("iframe");
      if (!frame || event.origin !== "https://calendly.com" ||
          event.source !== frame.contentWindow) return;
      switch (event.data?.event) {
        case "calendly.profile_page_viewed":
          pitchlane.track("calendar_step", { provider: "calendly", step: "profile_viewed" });
          break;
        case "calendly.event_type_viewed":
          pitchlane.track("calendar_step", { provider: "calendly", step: "event_type_viewed" });
          break;
        case "calendly.date_and_time_selected":
          pitchlane.track("calendar_step", { provider: "calendly", step: "time_selected" });
          break;
        case "calendly.event_scheduled": {
          // Local deduplication only. Never send invitee URIs or form data.
          const key = event.data.payload?.invitee?.uri || "this-widget";
          if (reported.has(key)) return;
          reported.add(key);
          pitchlane.track("calendar_booking", { provider: "calendly" });
        }
      }
    }
    window.addEventListener("message", onMessage);
    // A page can replace its calendar without navigating. Retire this widget's
    // listener; a replacement owns its own booking IDs and callbacks.
    const cleanup = new MutationObserver(() => {
      if (parentElement.isConnected) return;
      window.removeEventListener("message", onMessage);
      cleanup.disconnect();
    });
    cleanup.observe(document.documentElement, { childList: true, subtree: true });
    parentElement.style.height = "700px";
    Calendly.initInlineWidget({url: "https://calendly.com/example/intro", parentElement});
  });
</script>

SavvyCal

<!-- Replace the example link and matching slug. Keep this normal link as fallback. -->
<a href="https://savvycal.com/example/intro">Open scheduling page</a>
<div id="calendar"></div>
<script>window.SavvyCal = window.SavvyCal || function () { (SavvyCal.q = SavvyCal.q || []).push(arguments); };</script>
<script async src="https://embed.savvycal.com/v1/embed.js"></script>
<script>
  pitchlane.on("ready", () => {
    const parentElement = document.querySelector("#calendar");
    if (!parentElement) return;
    const reported = new Set();
    function onScheduled(event) {
      if (!parentElement.isConnected) return;
      // The provider exposes more details. Only use the opaque id locally.
      const key = event.detail?.id;
      if (!key || event.detail.link !== "example/intro" || reported.has(key)) return;
      reported.add(key);
      pitchlane.track("calendar_booking", { provider: "savvycal" });
    }
    window.addEventListener("savvycal.scheduled", onScheduled);
    // A page can replace its calendar without navigating. Retire this widget's
    // listener; a replacement owns its own booking IDs and callbacks.
    const cleanup = new MutationObserver(() => {
      if (parentElement.isConnected) return;
      window.removeEventListener("savvycal.scheduled", onScheduled);
      cleanup.disconnect();
    });
    cleanup.observe(document.documentElement, { childList: true, subtree: true });
    SavvyCal("init");
    SavvyCal("inline", {link: "example/intro", selector: "#calendar"});
  });
</script>

Preview, check, then assign

Use a starter or copy the template before changing just one campaign. A successful edit to a shared template updates every campaign using it. Run a global check first; optionally choose a campaign and a video record to check exposed fields, missing values and unreachable cues. A fixture preview is pinned to the saved version and contains synthetic data. A signed-in real-lead snapshot is private, not an interactive recipient link. Neither counts as a prospect visit.

See the HTTP API reference for available authoring endpoints and the webhook guide for delivery.