Setting up Google Analytics in Webflow to track only the production site, and fire an event on successful form submission involves integrating Google Analytics with Webflow and configuring Google Tag Manager for the form event. Here's how you can do it:
1. Add Google Analytics to Your Production Site
- Go to the Project Settings in your Webflow dashboard.
- Select the Integrations tab.
- Locate the Google Analytics section.
- Enter your Google Analytics tracking ID (e.g., UA-XXXXX-X) into the designated field.
- Save the changes to apply.
2. Use Google Tag Manager for Event Tracking
- Sign up or log into Google Tag Manager (GTM) and create a container for your Webflow site.
- Install GTM by adding the GTM tag to your Webflow site. This is done by clicking on the Custom Code tab within Project Settings and pasting your GTM code into the Head Code field.
- Publish the changes to ensure GTM is working on your live site.
3. Configure GTM to Fire Events on Form Submission
- Create a new Trigger in GTM:
- Choose Form Submission as the event type.
- Configure the conditions so the trigger fires only on the production domain.
- Ensure it triggers on some forms, specifying any specific conditions relevant to your setup.
- Create a new Tag in GTM:
- Select Google Analytics: Universal Analytics as the tag type.
- Set Track Type to Event and input relevant Category, Action, and Label values for the form submissions.
- Attach the Trigger you created for form submissions.
- Publish the updates to your GTM container.
4. Validate the Setup
- Preview your GTM configuration on your Webflow site to ensure the event fires correctly.
- Use Google Analytics Real-Time report to view events and verify that the integration is tracking submissions accurately.
Summary
By integrating Google Analytics through Project Settings and configuring Google Tag Manager to track form submissions on your production site, you can efficiently monitor user interactions specific to your custom domain. Ensure all configurations are specifically set to fire only on the production environment to maintain accurate analytics.