Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Does Usage Still Support Google Analytics for WebSites. #128

Closed
rayk opened this issue Sep 3, 2018 · 3 comments
Closed

Does Usage Still Support Google Analytics for WebSites. #128

rayk opened this issue Sep 3, 2018 · 3 comments

Comments

@rayk
Copy link

rayk commented Sep 3, 2018

There appears to a problem with usage or maybe it's just that I am missing something so simple.

Here is the setup:

  1. Dart VM version: 2.0.0 (Fri Aug 3 10:53:23 2018 +0200) on "macos_x64"
  2. angular: ^5.0.0
  3. Building with build_runner: ^0.10.1

Boiling down the problem to the simplest level:

import 'dart:async';
import 'package:angular/angular.dart';

import 'package:usage/usage_html.dart';

class AppComponent implements OnInit{
 
  final AnalyticsHtml _tracker;

  AppComponent() {
    _tracker = AnalyticsHtml("UA..", "appName", "v1.0.0")
      ..analyticsOpt=AnalyticsOpt.optIn
      ..onSend.listen((event) => _log.info('event'));
  };

  @override
  void ngOnInt()  {
      _tracker.sentEvent("App", "Startup");
   }
}

I have tried the above with and without <script async src="https://www.googletagmanager.com/gtag/js?id=UA......"></script> in the index.html.

I can trace and see _tracker.SendEvent being hit, nothing is being emitted and the OnSend does not receive an event.

I initally thought the problem is was with how I had setup Googel Analytics. But I have tried both using a website property setup with a "UA" code. I have used a mobile setup via Firebase. (Google Analytics redirect there now). I am quite sure the problem is at my end....

Anyhow I am at a total lost, is there something I am missing.

Thanks in advance.

@devoncarew
Copy link
Contributor

This library needs for the UA code to have been created with the 'mobile app' option:

https://github.com/dart-lang/usage#for-web-apps

But I see that that option is no longer available when creating a google analytics property (they prefer to use firebase now).

For web apps, you might try using a simple wrapper over the javascript version of the library (for an example of this, you can see what dartpad does: https://github.com/dart-lang/dart-pad/blob/master/lib/src/ga.dart).

@rayk
Copy link
Author

rayk commented Sep 4, 2018

Thank you for the reply, will proceed with the wrapper.

@devoncarew
Copy link
Contributor

closing as we're no longer going to actively work on this package (#195)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants