diff --git a/.yarn/install-state.gz b/.yarn/install-state.gz deleted file mode 100644 index 1f695e1..0000000 Binary files a/.yarn/install-state.gz and /dev/null differ diff --git a/README.md b/README.md index cb7fda6..7fbde25 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,112 @@ -### About +# Hellotext Integration Playground -This is a dummy React application that is meant to be a quick way for businesses -to get started with tracking events via [Hellotext.js](https://github.com/hellotext/hellotext.js). +A React application for quickly verifying the public [Hellotext JavaScript SDK](https://github.com/hellotext/hellotext.js) (`@hellotext/hellotext` npm package). Designed for customers and internal QA to test tracking events, forms, webchat, UTM capture, and session management — **without editing source code**. -### Getting started +## Prerequisites -1. Replace the `Hellotext.initialize` with your public business ID. -2. Write your code to test behaviour +- **Node.js** 16+ (LTS recommended) +- **Yarn** (the project uses Yarn 4 via Corepack, but `npm` works too) + +## Getting Started + +### 1. Install dependencies + +```bash +yarn install +``` + +### 2. Start the dev server + +```bash +yarn start +``` + +Opens [http://localhost:3000](http://localhost:3000) in your browser. + +### 3. Enter a Business ID + +The first screen asks for your **public Hellotext Business ID** (found in your Hellotext dashboard → Settings → Business). Enter it and click **Initialize SDK**. The ID is saved in localStorage for convenience — use the **Reset** button to change it. + +Optionally enter a **Webchat ID** to override dashboard-managed webchat settings. + +--- + +## Features + +### Session +Displays the current `Hellotext.session` token and listens for the `session-set` event. + +### UTM Capture +Shows how the SDK captures UTM parameters from the URL. Click the provided test link to reload with sample UTM params (`utm_source`, `utm_medium`, `utm_campaign`, etc.) and observe the `utm-set` event. + +**Test URL example:** +``` +http://localhost:3000/?utm_source=test&utm_medium=playground&utm_campaign=demo +``` + +### Tracking Events +Fire preset events (`product.viewed`, `cart.added`, `checkout.started`) or enter a custom event name + JSON params. Each call shows success/failure in the Event Log. + +### Forms +Enter a **Form ID** and click **Mount Form** to render a `