Why are my Android app events being excluded as bot traffic?
When testing Android mobile applications, events generated by automated agents (for example, requests using okhttp) may be excluded by Piano Analytics bot filtering. You can prevent this exclusion so the data remains available in your reporting interfaces.
Piano Analytics bot detection relies on recognized bot patterns, including the IAB list of known bots. Some Android networking stacks (notably okhttp) can produce User Agent strings that match bot signatures, which can lead to valid test or app traffic being classified as robot traffic and filtered out during processing.
Option 1: Force a non-robot User Agent
Manually force the User Agent to a value that is not identified as a robot.
You can copy the User Agent from your computer (desktop browser) and use it instead of the current User Agent.
You can also retrieve common User Agents from dedicated websites.
This approach is typically the most direct way to prevent exclusion when your requests are being flagged due to a User Agent such as okhttp.
Changing the User Agent in a native Android app may not align with some Android development best practices. Consider the implications for your application before deploying this change broadly.
Option 2: Disable bot detection at the event level
If you cannot change the User Agent of your requests, you can force them to be sent with the bot_detection method.
Set the bot_detection boolean property to false in your event properties.
bot_detection:true/falseTo prevent exclusion, set
bot_detectiontofalse
This is especially useful when the User Agent contains known patterns such as okhttp/ and you want to keep the events.
Troubleshooting
Android events missing in Data Query (React Native or native Android): If events are collected but do not appear in the interface, check whether the outgoing User Agent includes
okhttp/or another bot-like signature. If so, use one of the options above (change User Agent or setbot_detectiontofalse).Be cautious about broad allow-listing: If you consider allowing a bot-like User Agent globally (for example, treating
okhttpas valid), be aware this can increase the risk of real bot traffic being included in analytics across your organization.