(formData?: FormData)
| 204 | } |
| 205 | |
| 206 | function trackEvent(formData?: FormData) { |
| 207 | if (!formData) return |
| 208 | // Nota bene: convert empty strings to undefined |
| 209 | return sendEvent({ |
| 210 | type: EventType.survey, |
| 211 | survey_token: (formData.get('survey-token') as string) || undefined, // Honeypot |
| 212 | survey_vote: formData.get('survey-vote') === 'Y', |
| 213 | survey_comment: (formData.get('survey-comment') as string) || undefined, |
| 214 | survey_email: (formData.get('survey-email') as string) || undefined, |
| 215 | }) |
| 216 | } |