dart-lang / usage Goto Github PK
View Code? Open in Web Editor NEWA Google Analytics wrapper for command-line, web, and Flutter apps.
Home Page: https://pub.dev/packages/usage
License: BSD 3-Clause "New" or "Revised" License
A Google Analytics wrapper for command-line, web, and Flutter apps.
Home Page: https://pub.dev/packages/usage
License: BSD 3-Clause "New" or "Revised" License
Document that we ping GA in a best effort basis (and that failures are silent).
Hello,
I cannot get the last version (3.0.0) with pub get.
Moreover, the dedicated dart-lang website page of usage refer to the version 2.2.2
Is it normal?
Vincent
Curious, and looking to set expectations for future users :)
Flutter is affected by a bug fixed by 8ba4c02
We have a getPlatformLocale()
method, which is a poor man's version of what package:intl
can do. Should we take a dep in intl
and delegate to it? On dart:io
, require consumers to pass the platform locale into our constructor?
It would be nice to just be able to default the analytics application version parameter to the version in the pubspec of the entrypoint package. This should work for both command-line and html apps. This is blocked on http://dartbug.com/21169.
When you are creating a new property at google analytics make sure to select the mobile app option, not the website option.
I’m not sure if this is possible anymore. I selected mobile app but then you are forced to create a firebase analytics project?
This would give users access to sending arbitrary data to GA.
https://github.com/dart-lang/usage/blob/master/lib/src/usage_impl_io.dart#L52
It's possible we need additional ways to get the current language/locale?
http://superuser.com/questions/392439/lang-and-language-environment-variable-in-debian-based-systems
100% of the analytics reports from flutter_tool are missing language.
FYI @sethladd
Cover some of the branch cases in lib/src/usage_impl.dart
(https://coveralls.io/files/400138718).
We use conditional directives now.
this will help people testing their analytics implementation
We cannot load this version in sdk/DEPS without a tag.
Many methods in Analytics
use optional positionals. IMO optional positional should rarely be used on public APIs:
bool
s.null
when you only care about the trailing optionals (which might overwrite the default value).Change to named arguments?
severe: [INVALID_FIELD_OVERRIDE] Field declaration Analytics.optIn cannot be overridden in AnalyticsImpl. (package:usage/src/usage_impl.dart, line 85, col 3)
severe: [INVALID_FIELD_OVERRIDE] Field declaration Analytics.optIn= cannot be overridden in AnalyticsImpl. (package:usage/src/usage_impl.dart, line 87, col 3)
After #62 lands, we won't be testing stable any more. I'm creating this tracking issue so we can remember to bring it back once conditional directives are supported in the stable SDK.
While looking at Flutter's analytics for our new Windows support I realized that package:usage doesn't report the language of our Windows users. Looking at the package:usage code that's probably due to the fact that Windows doesn't have an env variable LANG
set: https://github.com/dart-lang/usage/blob/master/lib/src/usage_impl_io.dart#L139
Simple working example of a dart Web App (SPA) that uses usage would be appreciated. I have tried to implement one based on the console app but I have not been successful. A working Web App that is similar to the example console app would be very helpful.
E/flutter : [ERROR:dart_error.cc(17)] Unhandled exception:
E/flutter : No top-level method 'getFilesDir' declared.
E/flutter :
E/flutter : NoSuchMethodError: method not found: 'getFilesDir'
E/flutter : Receiver: top-level
E/flutter : Arguments: [...]
E/flutter : #0 NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:169)
E/flutter : #1 createAnalytics.<createAnalytics_async_body> (package:usage/src/usage_impl_flutter.dart:22)
E/flutter : #2 Future.Future.microtask.<anonymous closure> (dart:async/future.dart:144)
E/flutter : #3 _microtaskLoop (dart:async/schedule_microtask.dart:41)
E/flutter : #4 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
usage/lib/src/usage_impl_flutter.dart
Line 22 in 775bffd
getFilesDir was removed from flutter in flutter/flutter#3636
From: http://dart-atom.github.io/dartlang/entry_dart_results_10_16.html
DownCastComposite package:usage/src/usage_impl.dart
192 return _recordFuture(postHandler.sendPost(_GA_URL, args));
args (Map<dynamic, dynamic>) will need runtime check to cast to type Map<String, String>
https://support.google.com/analytics/answer/2709828?hl=en
We'd like to send custom dimensions for screens and events. Is there a way to do this with usage?
Thanks!
Maybe something like tool/ga.dart
Just a tracking issue to know when I can update my pubspec dependency. Guessing this is blocked on #4. Thanks!
For the dart:io provider, we're not recognizing windows platforms correctly. I suspect that the user agent we're synthesizing is incorrect (mac and linux platforms are being recognized).
Hello,
I have imported the version 2.0.0
When i compile my YAML i obtain this error:
Expected ';' after this.
import 'src/usage_impl_default.dart'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error from Dart2JS on myprjweb/dart/main.dart:
packages/usage/usage.dart:28:4:
'if' is a reserved word and can't be used here.
Try using a different name.
if (dart.library.js) 'src/usage_impl_html.dart'
^^
See the image below that shown the issue:
Thank you
Andrea
It'd be useful to track errors, especially
using 'pub.usage' or something as the name – or just let a user provide the details in the CTOR
This would pair with the existing setSessionValue()
method.
AnalyticsIO
should report the operating system version (e.g. Windows 7, Windows 10, MacOS 10.3, etc).
While regularly checking the output size (after dart2js) of your web application, I noticed a big increase. The uncompressed size of our javascript file increased by 400 kb. After compression using gzip it is still 100 kb bigger than before. This is not acceptable for us.
I investigated what this increase is causing: It is the use of the uuid
package and all it's dependencies. Currently uuid
is used to generate the unique client id.
Using uuid
in console applications is fine. Looks like the normal Google Analytics implementation is only using a simple random number as a client id.
I think it would be usefull if the generator for the client id could be set from the outside, or to force the use of a simple random number for the Html version of the library. The client id generator could be a simple callback function or a class as we already have for PostHandler
and PersistentProperties
.
We have problems with errors from HttpRequest.request
. There are several reasons that temporary error can occure, I our case it seems to be a Safari problem.
For now that means that we have a unhandled exception that crashes the application. We can add manually a catchError
to the returned futures from the Analytics class.
Now I wonder if we should move handling such exceptions directly into the post handler?
Probably somewhere like lib/uuid/uuid.dart
.
Add a regression test to cover the fix in #17.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.