The function trackAnalyticsOnClick will receive an object of type ParamsTrackAnalytic
Update --02/08/2023--
/** * This params should be used to track error events. * For Success events it is recommended to use Record<string, string>*/interfaceTrackParams{success?:boolean;//Determines the successful or failure of the eventeventInfo?:{message:string;};}/** * TrackParams should be used to track error events. * For Success events it is recommended to use Record<string, string>*/exportinterfaceParamsTrackAnalytics{eventName:string;//Name of eventparams?:TrackParams|Record<string,string>;}
eventName: Is the name of the event that is running (required)
params: Object with typeof Record<string, string>.
These params are used to send a pair of string values defined in the analytics document. The pair is composed by a PropertyName and PropertyValue, the properties will be attached to the event.
Here's an example
You can use convertPropertiesToRecord helper method to convert an array of properties to the expected format Record<string, string>
For the errors it is preferred to call the helper method evaluateErrorMessage because this method will parsed the data and will call the trackAnalyticsOnClick internally.
Here's an example
Calling trackAnalyticsOnClickwith the old structure will still supported for the events implemented before.
Before --02/03/2023--
eventName: Is the name of the event that is running (required)
params: Object composed of success and another object called eventInfo where
success: Represents the success or failure of the event
eventInfo: Represents values that allow identifying the reason for the event