Operator
Lead inbox
Guide downloads and estimate forms should land in your Google Sheet. Right now they only stay in this browser.
- 01 Create a Google Sheet named something like “Permian Asphalt Leads.”
- 02 Extensions → Apps Script. Delete the stub. Paste the script below. Save.
- 03 Deploy → New deployment → Web app. Execute as Me. Who has access: Anyone. Deploy and copy the URL (it ends in
/exec). - 04 Paste that URL below to test from this browser. Then send the same URL in chat so it can be baked into the live site — visitor phones never see this page.
Apps Script
function doPost(e) {
const lock = LockService.getScriptLock();
lock.tryLock(10000);
try {
const data = JSON.parse(e.postData.contents);
const ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Leads");
if (!sheet) sheet = ss.insertSheet("Leads");
if (sheet.getLastRow() === 0) {
sheet.appendRow([
"Received",
"Source",
"Name",
"Phone",
"Email",
"City",
"Property type",
"Notes",
"Id",
]);
sheet.getRange(1, 1, 1, 9).setFontWeight("bold");
sheet.setFrozenRows(1);
}
sheet.appendRow([
data.createdAt || new Date().toISOString(),
data.source || "",
data.name || "",
data.phone || "",
data.email || "",
data.city || "",
data.propertyType || "",
data.notes || "",
data.id || "",
]);
return ContentService.createTextOutput(JSON.stringify({ ok: true })).setMimeType(
ContentService.MimeType.JSON,
);
} finally {
lock.releaseLock();
}
}
This-browser tests
Submissions you make in preview on this device. Live visitor leads go to the Sheet, not here.
No test leads yet. Submit the guide form and come back.