Skip to content

Google Sheet Analytics Generator supported Flutter, Android, and iOS

License

Notifications You must be signed in to change notification settings

prongbang/analyticsgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AnalyticsGen

Google Sheet Analytics Generator Source Code supported Flutter, Android, and iOS

Download

Homebrew

$ brew update
$ brew tap prongbang/homebrew-formulae
$ brew install analyticsgen

Binary

Golang

go install github.com/prongbang/analyticsgen

Requirement

  • Create a Google Sheet and share with Anyone on the Internet with this link can view

Sheet

  • Extract from the link the DocumentId and SheetId values
https://docs.google.com/spreadsheets/d/<DocumentId>/edit#gid=<SheetId>
  • Example
https://docs.google.com/spreadsheets/d/1oBqyd7ys2GOtroqV6D4qYH6JWQjKrZiOcngmcsbq0VU/edit#gid=0

Usage

Flutter

  • Gen all
$ analyticsgen -platform flutter -sheet 0 -document 1oBqyd7ys2GOtroqV6D4qYH6JWQjKrZiOcngmcsbq0VU -target ./export -package firebasex/analytics
  • Gen by asset
$ analyticsgen -platform flutter -asset key -sheet 0 -document 1oBqyd7ys2GOtroqV6D4qYH6JWQjKrZiOcngmcsbq0VU -target ./export -package firebasex/analytics
$ analyticsgen -platform flutter -asset code -sheet 0 -document 1oBqyd7ys2GOtroqV6D4qYH6JWQjKrZiOcngmcsbq0VU -target ./export -package firebasex/analytics
  • Add analytics_utility.dart file into project
import 'package:firebase_analytics/firebase_analytics.dart';

abstract class AnalyticsUtility {
  Future<void> logAppOpen();

  Future<void> logEvent(String key, Map<String, dynamic> parameters);

  Future<void> setUserProperty(String key, String value);

  Future<void> logScreen(String screenName, {String screenClassOverride});
}

class FirebaseAnalyticsUtility implements AnalyticsUtility {
  final FirebaseAnalytics _firebaseAnalytics;

  FirebaseAnalyticsUtility(this._firebaseAnalytics);

  @override
  Future<void> logAppOpen() => _firebaseAnalytics.logAppOpen();

  @override
  Future<void> logEvent(String key, Map<String, dynamic> parameters) =>
      _firebaseAnalytics.logEvent(name: key, parameters: parameters);

  @override
  Future<void> setUserProperty(String key, String value) =>
      _firebaseAnalytics.setUserProperty(name: key, value: value);

  @override
  Future<void> logScreen(String screenName,
          {String screenClassOverride = 'Flutter'}) =>
      _firebaseAnalytics.setCurrentScreen(
        screenName: screenName,
        screenClassOverride: screenClassOverride,
      );
}

iOS

  • Gen all
$ analyticsgen -platform ios -sheet 0 -document 1oBqyd7ys2GOtroqV6D4qYH6JWQjKrZiOcngmcsbq0VU -target ./export
  • Gen by asset
$ analyticsgen -platform ios -asset key -sheet 0 -document 1oBqyd7ys2GOtroqV6D4qYH6JWQjKrZiOcngmcsbq0VU -target ./export
$ analyticsgen -platform ios -asset code -sheet 0 -document 1oBqyd7ys2GOtroqV6D4qYH6JWQjKrZiOcngmcsbq0VU -target ./export

Android

  • Gen all
$ analyticsgen -platform android -sheet 0 -document 1oBqyd7ys2GOtroqV6D4qYH6JWQjKrZiOcngmcsbq0VU -target ./export
  • Gen by asset
$ analyticsgen -platform android -asset key -sheet 0 -document 1oBqyd7ys2GOtroqV6D4qYH6JWQjKrZiOcngmcsbq0VU -target ./export
$ analyticsgen -platform android -asset code -sheet 0 -document 1oBqyd7ys2GOtroqV6D4qYH6JWQjKrZiOcngmcsbq0VU -target ./export

About

Google Sheet Analytics Generator supported Flutter, Android, and iOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published