Created
February 8, 2026 12:34
-
-
Save vanaf1979/4a1ef370a482e9642eb7244a9f1867f7 to your computer and use it in GitHub Desktop.
GA4 ajax form submittion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const form = document.getElementById('contact-form'); | |
| form.addEventListener('submit', function(e) { | |
| // Your existing form logic here... | |
| gtag('event', 'generate_lead', { | |
| 'event_category': 'Contact', | |
| 'event_label': 'Main Contact Form', | |
| 'value': 1.0 // Optional: assign a lead value | |
| }); | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment