Capture Google Forms Embeds on WordPress
Google Forms embedded in WordPress via iframe offer limited customization and no page-level attribution. LeadToSheet adds UTM tracking, device context, and real-time sync to your own Google Sheet workspace.
CMS: WordPress
Overview
Google Forms is the most common free survey tool, but its iframe embed on WordPress creates a walled garden: responses go to the form owner's Google account with no visitor attribution. LeadToSheet supplements this by capturing submission events on the parent page and enriching each response with the WordPress page context, referrer, UTM parameters, and device metadata.
Implementation checklist
- 1
Add the LeadToSheet SDK to your WordPress site
Inject the snippet via your theme footer. Because Google Forms renders in a strict cross-origin iframe, the SDK works in tandem with a webhook to capture responses.
LeadToSheet snippet
<script>(function(w,d,s,u,k,e){if(w.__formsync){return}w.__formsync={q:[],k:k,endpoint:e};var js=d.createElement(s);js.src=u;js.async=1;js.onload=function(){w.__formsync.init&&w.__formsync.init({ clientKey:k })};d.head.appendChild(js);})(window,document,'script','https://www.leadtosheet.com/sdk.min.js','YOUR_CLIENT_KEY','https://www.leadtosheet.com/api/ingest');</script> - 2
Connect Google Forms to LeadToSheet via Apps Script
Google Forms iframes block all cross-origin communication. Open the Google Form, go to Script Editor, and add the LeadToSheet webhook trigger that fires on form submission. Copy the webhook URL from your LeadToSheet dashboard.
Tip: Use the `onFormSubmit` trigger in Apps Script. This server-side approach bypasses the iframe restriction entirely and is the most reliable capture method for Google Forms.
- 3
Enrich with page context from the SDK
The LeadToSheet SDK on the WordPress page captures UTMs, referrer, and device data. Google Form submissions arrive via the Apps Script webhook independently from the SDK's page-level tracking. UTM parameters and referrer data are captured separately by the SDK on the host page but are not automatically correlated with webhook submissions.
Customization ideas
Add attribution to survey responses
Google Forms does not track where respondents came from. LeadToSheet enriches each row with the referring WordPress page URL, UTM parameters, and traffic source so you can attribute survey responses to campaigns.
Consolidate multiple form responses
If you embed different Google Forms on different WordPress pages, LeadToSheet routes all responses into a single sheet with a form identifier column, simplifying cross-form analysis.
Trigger notifications on specific answers
Use Google Sheets conditional formatting or Apps Script triggers on the LeadToSheet-managed sheet to send Slack or email alerts when specific answer values appear.
Troubleshooting
Google Forms iframe blocks all client-side capture
Google Forms iframes use strict cross-origin policies with no postMessage support. Client-side capture alone is insufficient. You must use the Apps Script webhook method described in the setup checklist for reliable data capture.
Responses appear in Google Forms but not in your sheet
Verify the Apps Script trigger is deployed and authorized. Go to the Google Form's Script Editor, check the Triggers panel, and ensure the `onFormSubmit` trigger is active and the LeadToSheet webhook URL is correct.
UTM data is missing from captured rows
Page context enrichment requires the LeadToSheet SDK to be loaded on the WordPress page AND for the visitor to be on the same session. If users open the Google Form in a new tab instead of submitting in the embed, attribution context may be lost.
Resources
Frequently asked questions
- Why can't LeadToSheet capture Google Forms directly from the iframe?
- Google Forms iframes enforce strict cross-origin policies and do not emit postMessage events. The Apps Script webhook approach sends data server-side, bypassing this limitation entirely.
- Does this replace Google Forms' built-in Sheets integration?
- It works alongside it. Google Forms' native Sheets connection stores raw responses. LeadToSheet adds attribution data, device context, and routes submissions to your own sheet structure with consistent formatting.
- Can I capture file upload responses from Google Forms?
- No. LeadToSheet only captures text-based form field values and does not process file uploads. To access uploaded files, use Google Forms' native response sheet or Google Drive integration.
