Tracking Pages
Add Intent filter
To create nudges from the Dashboard, connect your Android application by adding the following snippet to the Manifest file under the MainActivity section. This allows Nudge to send app pages to the dashboard for creating experiences:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="nudge-{APP_SCHEME_ID}"
android:host="nudgenow.com"
android:pathPattern="/.*/.*" />
</intent-filter>
Adding Labels to Your Widgets
To track specific widgets where you want to show nudges, import the NudgeWidgetTracker
:
import 'package:nudgecore_v2/utilities/nudge_labels_manager/NudgeWidgetTracker.dart';
Use NudgeWidgetTracker.register("YOUR_UNIQUE_WIDGET_NAME")
to track any widget in your application.
Here's an example:
ElevatedButton(
key: NudgeWidgetTracker.register("HeyButton"),
onPressed: () {
nudge.track(type: 'Name of your component');
},
child: Text('Hey'),
),
note
Make sure each widget name is unique to avoid conflicts.
Adding Page to the dashboard
- Go to the Pages section in your dashboard
- Scan the QR code with the build that has the above mentioned intent filter
- Click on Launch Application.
- Click on the Nudge icon to send screenshot to the dashboard.