Closed
Description
So I basically trying to write a interop for the ga
function of google analytics.
The problem is that it is not only a function, but also exposes properties (l
and q
).
The following code, actually runs, and sends pageview events to google analytics. The only way to make the analyzer happy is add a call
method. However, if I do that, dart2js breaks.
So basically, this codes works fine, but I just want to silence the analyzer.
import 'package:js/js.dart';
@JS('ga')
external Ga get ga;
@JS('ga')
class Ga {
external int get l;
external set l(int l);
external List get q;
external set q(List q);
}
class Analytics {
Analytics(String trackingNumber) {
ga.l = new DateTime.now().millisecondsSinceEpoch;
ga('create', trackingNumber, 'auto');
}
send(String event) {
ga('send', event);
}
}