-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from grahamsmith/example_and_readme
Example and readme
- Loading branch information
Showing
4 changed files
with
149 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
example/lib/MyExampleAnalytics/example_analytics_vendor.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'package:analyticsx/actions/track_event.dart'; | ||
import 'package:analyticsx/analytics_action.dart'; | ||
import 'package:analyticsx/analytics_vendor.dart'; | ||
import 'package:example/MyExampleAnalytics/simple_counter_event.dart'; | ||
|
||
class ExampleAnalyticsVendor extends AnalyticsVendor { | ||
static ExampleAnalyticsVendor analytics = ExampleAnalyticsVendor(); | ||
|
||
ExampleAnalyticsVendor() : super('ExampleAnalytics'); | ||
|
||
@override | ||
void init() { | ||
print('ExampleAnalytics has run init()'); | ||
} | ||
|
||
@override | ||
void handleAction(AnalyticsAction action) { | ||
if (action is TrackEvent) { | ||
print('TrackEvent: ${action.eventName} with ${action.parameters}'); | ||
} | ||
|
||
if (action is SimpleCounterEvent) { | ||
print('CountEvent: ${action.counterName} has count ${action.count}'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//Example analytics event that represents a simple counter | ||
//This event is supported by ExampleAnalyticsVendor | ||
|
||
import 'package:analyticsx/analytics_action.dart'; | ||
|
||
class SimpleCounterEvent extends AnalyticsAction { | ||
final String counterName; | ||
final int count; | ||
|
||
SimpleCounterEvent(this.counterName, this.count); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters