Track conversions only after your backend validates the data to avoid bots

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the web-development category.

Last Updated: 2024-04-24

Google Analytics told me I had 80 email signups, whereas my website said I had only one. My logs showed many people (probably bots) applied with blank email addresses, so that would mean I massively over-counted events in Analytics, screwing up my conversion statistics.

Lesson

Do not track conversion events for signups when a form is submitted. This is because it might be blank data (e.g. from bots). Wait until you get a success response back from your server to count the conversion.