Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stopped sending events while in debug #10

Merged
merged 5 commits into from
Jul 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.0.9] - 7/19/19
* Allowed user to specifiy whether to show debug logs
* Disabled sending events (by default) to Mixpanel during debugging.

## [1.0.8] - 7/04/19
* Updated Dart SDK constraints in pubspec
* Updated all dependencies
Expand Down
16 changes: 12 additions & 4 deletions lib/pure_mixpanel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ class Mixpanel {
final String token;
final bool debug;
final bool trackIp;
final bool showDebugLog;

Mixpanel({@required this.token, this.debug: false, this.trackIp: false});
Mixpanel({
@required this.token,
this.debug: false,
this.trackIp: false,
this.showDebugLog = true,
});

Future<http.Response> track(String eventName,
{String distinctID, Map<String, String> properties}) async {
Expand All @@ -28,11 +34,13 @@ class Mixpanel {
final uri = MixpanelUri.create(path: '/track', queryParameters: {
'data': payload,
'verbose': (this.debug ? '1' : '0'),
'ip': (this.trackIp ? '1': '0'),
'ip': (this.trackIp ? '1' : '0'),
});
if (debug) {
print(
'mixpanel req\n\tproperties: $properties\n\turi: ${uri.toString()}');
if (showDebugLog)
print(
'IN DEBUG NOT SENDING TO MIXPANEL: \n req\n\tproperties: $properties\n\turi: ${uri.toString()}');
return null;
}
return http.get(uri.toString());
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pure_mixpanel
description: A new pure Dart library for Mixpanel analytics.
version: 1.0.8
version: 1.0.9
author: Nicholas Manning <puremixpanel@gmail.com>
homepage: https://github.com/seenickcode/pure_mixpanel

Expand Down