Respectlytics Respect lytics
Sign In Start Free Trial
Menu
Flutter Search query Privacy-first

How to track search queries in Flutter without personal data

In-app search is one of the highest-leverage product surfaces and one of the highest-PII-risk events to instrument. Most analytics SDKs default to ingesting the query string, building per-user search histories that are extremely sensitive. Respectlytics helps developers avoid collecting personal data in the first place: in Flutter, search is one named event per search action, with no query text. Below: how to instrument search submission, what to track instead of queries, and how to size search-driven funnels.

Fire the call when the user submits a search β€” Enter key, Search button, suggestion tap. Don't pass the query string, the result count, or any normalized form of the query.

β–ΈInstall the Flutter SDK

yaml Respectlytics
# pubspec.yaml
dependencies:
 flutter:
 sdk: flutter
 respectlytics_flutter: ^3.0.0

Pure Dart β€” no platform channels for analytics. Same code on every platform Flutter compiles to (iOS, Android, web, macOS, Windows, Linux). On web, events are sent via the REST API; mobile platforms use the same path.

β–ΈInitialize Respectlytics in Flutter

dart Respectlytics
import 'package:flutter/material.dart';
import 'package:respectlytics_flutter/respectlytics_flutter.dart';
Future<void> main() async {
 WidgetsFlutterBinding.ensureInitialized();
 await Respectlytics.configure(appKey: '<YOUR_APP_KEY>');
 runApp(const MyApp());
}

Initialize in main() after WidgetsFlutterBinding.ensureInitialized() and before runApp(). The future completes immediately on configuration; events queued before completion are flushed once the network is available.

β–ΈTrack the event in Flutter

dart Respectlytics
import 'package:respectlytics_flutter/respectlytics_flutter.dart';
Future<List<SearchResult>> submitSearch(String query) async {
 Respectlytics.track('search_query');
 final results = await api.search(query);
 if (results.isEmpty) {
 Respectlytics.track('search_zero_results');
 }
 return results;
}

Wire to the search-form's onSubmitted callback, not onChanged (per-keystroke is noise).

✦Privacy & implementation notes

Search queries are some of the most sensitive content in your app β€” users type personal questions, medical concerns, addresses, names. The European Court of Justice has ruled IP + search-query combinations are personal data in multiple cases. Respectlytics's API rejects free-text payloads at the boundary; the query never gets that far.

Your search backend stores queries for ranking and quality work β€” that's its job, with proper retention and access controls. Mirroring those queries into analytics gives you a second store with weaker controls and no clear purpose. Respectlytics's role is the product-engagement layer above search, not the search-content layer itself.

The Flutter SDK is pure Dart. No MethodChannel, no platform-specific iOS or Android plugin code. The same code runs on every platform Flutter supports β€” including web and desktop targets. This eliminates one common audit surface ("what's the Android implementation doing?").

Always initialize after WidgetsFlutterBinding.ensureInitialized() and before runApp(). If you skip the binding step, the configure call will throw on platforms that need a binding for asynchronous I/O. The SDK documentation example uses this pattern by default.

⇋How this compares to other analytics SDKs

Search eventFirebase AnalyticsMixpanelRespectlytics
Query string storedCommon (free-text param)CommonForbidden (PII)
Result count as parameterRecommendedRecommendedOut of scope
Per-user search historyYesYesOut of scope
Search β†’ result-clicked funnelPer-userPer-userSession-scoped
Zero-result ratePer-user from query propertyPer-userUse distinct event_name

❓Frequently asked questions

How do we know what users search for if we don't store queries?

Your search backend (Algolia, Elastic, your own) already has the query data with appropriate retention and access controls. That's where query analytics lives. Respectlytics is for the product surface β€” "is search getting used and is it converting?" β€” not the content of queries.

What about zero-result queries?

Distinct event name: search_zero_results. Fire it instead of (or in addition to) search_query when the result set is empty. The rate of zero-result over total search is a UX-quality signal you can read directly.

Can we still measure search-driven conversion?

Yes, per-session. A session with search_query followed by product_viewed (or whatever your conversion event is) is a converting session. The funnel auto-discovery surfaces this without manual config.

What about voice search vs typed search?

Distinct event names: search_query_typed, search_query_voice. Their completion rates and result-click patterns differ enough to be worth splitting.

β‡’Related guides

How to track search query in Swift (iOS) without personal data Same event, Swift (iOS) How to track search query in Kotlin (Android) without personal data Same event, Kotlin (Android) How to track search query in React Native without personal data Same event, React Native How to track paywall conversion in Flutter without personal data Same framework, Paywall conversion How to track onboarding completion in Flutter without personal data Same framework, Onboarding completion How to track sign-up in Flutter without personal data Same framework, Sign-up How to track push notification opt-in in Flutter without personal data Same framework, Push notification opt-in How to track paywall view in Flutter without personal data Same framework, Paywall view How to track trial start in Flutter without personal data Same framework, Trial start How to track trial β†’ paid conversion in Flutter without personal data Same framework, Trial β†’ paid conversion How to track subscription renewal in Flutter without personal data Same framework, Subscription renewal How to track subscription cancellation in Flutter without personal data Same framework, Subscription cancellation

Track what matters. Collect nothing you don't.

Five-field event schema, RAM-only event queue, no IDFA, no AAID, no persistent user IDs. Helps developers avoid collecting personal data in the first place.

Get started with the SDKs See pricing

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /