Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

florent37/AndroidAnalytics

Repository files navigation

AndroidAnalytics

Download

Android app on Google Play

Buy Me a Coffee at ko-fi.com

In your module Download

//not available yet
compile 'com.github.florent37:androidanalytics:1.0.0'
compile 'com.github.florent37:androidanalytics-google:1.0.0'

Register analytics providers

MainApplication.java

Analytics.registerProvider(
      new GoogleAnalyticsProvider(this, R.xml.app_tracker)
);

example of app_tracker.xml :

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="ga_trackingId" translatable="false">UA-XXXXXXX-X</string>
</resources>

Send events

MainActivity.java

Analytics.screen("MainActivity");

button.setOnClickListener(v -> {
         Analytics.event(new AnalyticsEvent()
                 .category("main")
                 .action("click")
                 .label("button")
         );
});

MainActivity.java

Analytics.screen("MainActivity");

button.setOnClickListener(v -> {
         Analytics.event("main", "click", "button");
});

Another analytics provider

Analytics
          .registerProvider(
                  new AnalyticsProvider() {
                      @Override
                      public void event(AnalyticsEvent analyticsEvent) {
                            //send it to your analytics
                      }

                      @Override
                      public void screen(String screenName) {
                            //send it to your analytics
                      }
                  }
          );

Loggin analytics provider

Analytics.registerProvider(
       new AnalyticsLogginProvider("analytics")
);

Credits

Author: Florent Champigny

Fiches Plateau Moto : https://www.fiches-plateau-moto.fr/

Android app on Google Play Follow me on Google+ Follow me on Twitter Follow me on LinkedIn

License

Copyright 2016 florent37, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Analytics dispatcher for Android Applications

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published