# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## What this repo is

Static marketing/landing pages for **"ONE by MSN"**, a luxury residential project (MSN Realty, Kokapet/Neopolis, Hyderabad). There is no build system, package manager, or test suite — this is plain HTML/CSS/JS deployed as-is to a PHP-capable host, plus two small PHP endpoints for lead capture and analytics ingestion. There are no git commits yet (repo initialized but empty history).

Each top-level `.html` file is an **independent, self-contained landing page variant**, typically built for a specific ad campaign / traffic source, not components of a single app:

| File | Variant / traffic source |
|---|---|
| `onebymsn.html` | Primary/production landing page — most complete integration (analytics, tracking, ingestion) |
| `onebymsn-backup.html` | Backup/previous version of the primary page |
| `msn.html` | Legacy variant, uses its own `assets/css/msn.css` instead of the shared `css/`/`js/` |
| `GreatAndhra.html`, `NRI.html`, `nri-eenadu.html`, `nri-sakshi.html`, `dg.html` | Campaign-specific variants for different publishers/ad sources, mostly duplicated markup with minor copy/branding differences |
| `privacypolicy.html`, `thankyou.html` | Supporting pages (privacy policy, post-submit redirect target) |

Because pages are largely copy-pasted rather than templated, **a fix or content change usually needs to be applied to every relevant HTML file individually** — check which variants share the issue before editing just one.

## Architecture

### Frontend
- No bundler/framework. Pages pull Bootstrap 5, jQuery, AOS, Swiper, Slick, Fancybox from public CDNs, plus shared local assets:
  - `css/onestyley.css`, `css/icon.css`, `css/nri.css` — shared styles (most pages)
  - `js/indexs.js` — shared page behaviors (counters, nav, etc.)
  - `js/jquery.js`, `js/geocoder.js` (bundled `leaflet-control-geocoder`) — vendored libs
  - `js/tracking.js` / `js/tracking.min.js` — custom analytics module (see below); keep both in sync when editing, or regenerate the minified file from source
- `msn.html` is the exception, using its own `assets/` tree (`assets/css`, `assets/fonts`, `assets/images`) instead of the shared `css/`/`js/` roots.
- Media lives under `media/` (images, brochures/floor-plan PDFs, per-section subfolders like `clubhouse/`, `elivations/`, `Plans/`, `nri/`, `onebymsn/`, `oneofakind/`). Prefer the `.webp` version where both `.png`/`.jpg` and `.webp` exist for a given image.

### Lead capture (two different paths — don't assume they're the same)
- **`onebymsn.html`, `msn.html`, `NRI.html`, `GreatAndhra.html`, `nri-eenadu.html`, `nri-sakshi.html`**: forms `POST` directly, client-side, to the Salesforce Apex REST endpoint `https://msnrealty.my.salesforce-sites.com/services/apexrest/LeadGen?APIKey=...`.
- **`dg.html`**: submits to `submit.php` (server-side), which verifies a Google reCAPTCHA response then forwards the payload to the same Salesforce `LeadGen` endpoint.
- Successful submission on the main page redirects to `thankyou.html` (referenced via the production URL `https://www.msnrealty.com/new-lp/thankyou.html`).

### Analytics / Data Cloud ingestion (`js/tracking.js` + `ingest.php`)
`js/tracking.js` defines a `MSNTracking` global with a dual-path architecture (see the file's header docblock for the full API and event taxonomy):
- **Path A (client-side)**: pushes to `dataLayer` / `sfWebInteractionsDataLayer` → GTM (`GTM-TDGSBR72`) → GA4 → Data Cloud, plus a Salesforce c360a beacon script.
- **Path B (server-side)**: browser calls `MSNTracking.trackLeadSubmit()` / section-view / floor-plan-click helpers → these POST to `ingest.php` → which authenticates to Salesforce (OAuth client-credentials, then a Data Cloud token exchange) → posts to the Salesforce Data Cloud Ingestion API for the `msn_web_event` and `msn_web_user_profile` objects.
- `ingest.php` caches the Data Cloud access token in `.msn_dc_token.json` next to itself and auto-refreshes 5 minutes before expiry, retrying once on a 401.
- Only `onebymsn.html` currently wires up `MSNTracking.init(...)` and `ingest.php`; other variants use only the direct Salesforce lead-form POST without this richer tracking.

**Security note:** `ingest.php` hardcodes a live Salesforce client ID/secret, and `.msn_dc_token.json` stores a live access token in plaintext in the repo root — same for the reCAPTCHA secret key hardcoded in `submit.php`. Treat these as real secrets; don't copy them into examples, logs, or new files, and flag before committing them anywhere public.

## Working in this repo
- There's no dev server or build step — open the HTML files directly, or serve the directory with any static/PHP server (e.g. `php -S localhost:8000`) to exercise `ingest.php`/`submit.php`.
- No linter or test suite is configured.
- When changing shared assets (`css/`, `js/`), check all HTML files that reference them (see table above) — most pages share `css/onestyley.css`, `css/icon.css`, and `js/indexs.js`, but `msn.html` does not.
