Track widget events in Google Analytics 4
Send widget events like clicks and form sign-ups to Google Analytics 4 with your Measurement ID and a Measurement Protocol API secret.
Embeddable sends widget events to Google Analytics 4 using the Measurement Protocol. You connect it with two codes from Google Analytics, your Measurement ID and an API secret, then choose which events to send.
Before you start: have your Google Analytics 4 property ready, with a web data stream for your site.
Get your two codes
- In Google Analytics, open Admin, then Data streams, and click your website's stream.
- Copy the Measurement ID. It starts with G-.
- On the same page, open Measurement Protocol API secrets and click Create. Give the secret a name, like "Embeddable", and copy its value.
Connect Google Analytics
Google Analytics needs both codes, so connect it from Connect apps. The connection card in the AI chat doesn't save the API secret, and events won't reach Google Analytics without it.
If you already connected Google Analytics from the chat, disconnect it first, using the trash icon on the card or Disconnect in Connect apps. Then follow these steps.
- Open your widget in the editor.
- Click More, then Connect apps.
- Find Google Analytics and click Connect.
- Click Continue. If you see Which account? instead, choose Add another account.
- Give the connection a name in Name (only you see this). Paste the Measurement ID into Measurement ID (starts with G-) and the secret into API secret.
- Click Save and continue, make sure the new account is selected under Which account?, and click Connect.
To disconnect Google Analytics later, open it in Connect apps and click Disconnect.
Choose events
Widgets built with the AI usually report what people do in them already, with event names like form_submit and button_click. Once Google Analytics is connected, those events are sent to it too. To add or change events, tell the AI in the editor chat. For example:
- "Send an event to Google Analytics when someone clicks the Get a Quote button."
- "Send an event to Google Analytics when the form is submitted."
Typical choices are button clicks and form sign-ups. Keep the list short, so the events in your GA4 reports stay easy to read.
When you're done, publish your widget and test it:
- Open the page on your live site where the widget is embedded.
- Click the button or fill in the form yourself.
- In Google Analytics, open the Realtime report and look for the event.
Events are only sent from your live widget. Clicks in the editor preview aren't sent, so they won't show up in Google Analytics.
If events don't appear, check these first:
- The Measurement ID and API secret match the ones in Google Analytics exactly, with no extra spaces. To fix a typo, disconnect and connect again.
- You tested on your live site, not in the editor preview, after connecting.
- Google Analytics still shows as connected under More, then Connect apps.
If it still doesn't work, email us through the contact page with the widget name.
Did this answer your question?
Your feedback helps us improve.
