Upload Callbacks (onUploadSuccess / onUploadError)
Concept
| Description | onUploadSuccess and onUploadError let you react to file upload outcomes. Use them to send analytics events when a file upload succeeds or fails. |
onUploadSuccess
| Type | () => void |
| Description | Fires when file upload and parsing succeed and the content policy passes, once per successful upload attempt. Also fires if stepHandler.uploadStep blocks navigation. Does not fire when the user clicks "Manual Entry". |
onUploadError
| Type | ({ type: string, message: string }) => void |
| Description | Fires when a file upload fails and the user sees an error modal. The message field contains the same localized string shown in the error modal body. Does not fire when a parse is cancelled or when stepHandler.uploadStep throws an error. |
Error types
type | Scenario |
|---|---|
file-invalid-type | File format is not in inputTypes |
file-too-large | File exceeds the maximum size |
too-many-files | Multiple files uploaded when multipleFileUpload is false |
parse-error | File could not be parsed due to invalid formatting |
advanced-parsing-not-allowed | File requires advanced parsing that is not included in the subscription |
empty-file | File is empty after parsing |
max-records-exceeded | Row count exceeds maxEntries |
unknown | Any other parse error |
Basic syntax
<DataImporter
licenseKey="Your License Key"
settings={{
developerMode: true,
identifier: "product_data",
columns: [],
}}
onUploadSuccess={() => analytics.track("file-upload-success")}
onUploadError={({ type, message }) => analytics.track("file-upload-error", { type, message })}
/>