forms

Marketing Forms Documentation

Purpose

This document explains the role of form.html and the associated JavaScript files in this repository at a high level. It orients contributors to where behavior lives and how to run and edit the form locally.

Quick start

Run the project locally and open the form page:

python3 -m http.server 8080
# open http://localhost:8080/form.html

Key files

How it works (overview)

Data flow

  1. Page loads with URL parameters and referrer context.
  2. js/site.js captures attribution data (mtm_*, UTM values, campaign hints, language, entry/referrer URLs) and stores a normalized record in localStorage.
  3. Form lifecycle events trigger js/form.js.
  4. js/form.js reads attribution and browser context, then enriches fields (IP, country, language, campaign/UTM, website-derived metadata).
  5. The enriched form is submitted with populated values for downstream systems.

Key behaviors

Editing guidance

Dependencies and external services

Troubleshooting

JavaScript

This project exposes two primary frontend scripts. The descriptions below summarize the main functions and responsibilities so contributors can find and modify behavior quickly.

Together these scripts separate concerns: js/site.js focuses on capturing and persisting cross-page attribution, while js/form.js consumes that data to enrich forms (autofill, UX, metadata, and diagnostics).


Generated on 2026-04-08 — concise README for form.html and its JS files.