cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

React-native send events

Dyllan
Newcomer

Hello,

I am trying to send a custom event from my React-native application to the Dynatrace portal. I am using the dynatrace/react-native@2.323.1 plugin. My main objective is to log or capture the amount of times users visit a certain screen. The standard UserAction only displays which screen I want a little more information.


How I send the event (There is currently no UserAction going on that happend before):

static sendLog(log: object): void {
Dynatrace.sendEvent({ ...log, nothingToSeeTestField: 'Testvalue' });
}

I get the following logs when sending the event:

LOG [SendEventValidation]: modifyEvent({"body":{"event":"page_visit","pageName":"Mijn Dossiers","pageKey":"mijn-dossiers","timestamp":1759144670432,"sessionId":"session_1759144663479_3yj7cg6ns","platform":"ios","previousPage":"alle-dossiers","incidentCount":0},"severityNumber":9,"severityText":"INFO","nothingToSeeTestField":"nothingToSeeTestValue"})
LOG [SendEventValidation]: isKeyNameAllowed(): Filtering key body as this field or namespace is reserved!
LOG [SendEventValidation]: isKeyNameAllowed(): Filtering key severityNumber as this field or namespace is reserved!
LOG [SendEventValidation]: isKeyNameAllowed(): Filtering key severityText as this field or namespace is reserved!
LOG [SendEventValidation]: isKeyNameAllowed(): Filtering key nothingToSeeTestField as this field or namespace is reserved!
LOG [EventPipeline]: insertEvent({"dt.support.api.has_dropped_custom_properties":true,"start_time":1759144670436,"duration":0})
LOG [EventPipeline]: forwardEvent({"dt.support.api.has_dropped_custom_properties":true,"start_time":1759144670436,"duration":0,"dt.rum.event.source.type":"react_native","react_native.bundle.name":"simca","react_native.bundle.version":"2.0.6"})

 This happens on both Android and iOS.

So my question is: where can I find the event, if it is being sent at all? Is it even possible to send an event this way, or does it always need to be linked to a UserAction? Or is there a better way to capture the user behaivor for visting the screens.

1 REPLY 1

Patrick_H
Dynatrace Leader
Dynatrace Leader

Hi!

sendEvent is part of the New RUM APIs for RUM on Grail which is currently in preview - as you also mentioned User Actions this sounds like Dynatrace Classic, for which this API does not work. This API also has limitations on which fields can be modified and as the log shows most of your fields are dropped and also the event is reported with dropped custom properties.
For Dynatrace Classic you can only enrich user actions with child events like described in user action modification like https://docs.dynatrace.com/docs/shortlink/ios-oneagent-sdk#modify-auto-actions which is not yet available for React Native. You would need to just manually create user actions and child events for your use-case.

iOS help: https://www.dynatrace.com/support/help/shortlink/ios-hub

Featured Posts