All Projects → Winfooz → WinAnalytics

Winfooz / WinAnalytics

Licence: MIT License
A light-weight android library that can be quickly integrated into any app to use analytics tools.

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to WinAnalytics

Kripton
A Java/Kotlin library for Android platform, to manage bean's persistence in SQLite, SharedPreferences, JSON, XML, Properties, Yaml, CBOR.
Stars: ✭ 110 (+378.26%)
Mutual labels:  annotations, annotation-processor
Tracklytics
✔️ Annotation based tracking handler with aspect oriented programming
Stars: ✭ 416 (+1708.7%)
Mutual labels:  analytics, annotations
Placeholderview
This library provides advance views for lists and stacks. Some of the views are build on top of RecyclerView and others are written in their own. Annotations are compiled by annotation processor to generate bind classes. DOCS -->
Stars: ✭ 2,104 (+9047.83%)
Mutual labels:  annotations, annotation-processor
Kpoet
An expressive DSL built on top of JavaPoet to make writing code almost as easy as writing the code yourself.
Stars: ✭ 58 (+152.17%)
Mutual labels:  annotations, annotation-processor
AnnotationProcessorStarter
Project to set up basics of a Java annotation processor
Stars: ✭ 19 (-17.39%)
Mutual labels:  annotations, annotation-processor
Kotlin Builder Annotation
A minimal viable replacement for the Lombok @Builder plugin for Kotlin code
Stars: ✭ 67 (+191.3%)
Mutual labels:  annotations, annotation-processor
mixpanel-lite
2.9k alternative to mixpanel-js with offline support for PWAs
Stars: ✭ 49 (+113.04%)
Mutual labels:  analytics, mixpanel
growthbook
Open Source Feature Flagging and A/B Testing Platform
Stars: ✭ 2,342 (+10082.61%)
Mutual labels:  analytics, mixpanel
AnnotationProcessing
✔️ㅤ[ARTICLE] Writing your own Annotation Processors in Android
Stars: ✭ 47 (+104.35%)
Mutual labels:  annotations, annotation-processor
simple-preferences
Android Library to simplify SharedPreferences use with code generation.
Stars: ✭ 48 (+108.7%)
Mutual labels:  annotations, annotation-processor
Gsonpath
A Java annotation processor library which generates gson type adapters using basic JsonPath style annotations
Stars: ✭ 54 (+134.78%)
Mutual labels:  annotations, annotation-processor
mixpanel-engage-query
Command line tool to query the MixPanel Engage API for People Data.
Stars: ✭ 48 (+108.7%)
Mutual labels:  analytics, mixpanel
Zerocell
Simple, efficient Excel to POJO library for Java
Stars: ✭ 53 (+130.43%)
Mutual labels:  annotations, annotation-processor
dagger2-ktx
Kotlin extension bridge library for Dagger2 (proof-of-concept)
Stars: ✭ 41 (+78.26%)
Mutual labels:  annotations, annotation-processor
Preferenceroom
🚚 Android processing library for managing SharedPreferences persistence efficiently and structurally.
Stars: ✭ 341 (+1382.61%)
Mutual labels:  annotations, annotation-processor
aptk
A toolkit project to enable you to build annotation processors more easily
Stars: ✭ 28 (+21.74%)
Mutual labels:  annotations, annotation-processor
ColdStorage
Lightweight data loading and caching library for android
Stars: ✭ 39 (+69.57%)
Mutual labels:  annotations, annotation-processor
AutoBindings
Set of annotations that aims to make your Android development experience easier along with lint checks.
Stars: ✭ 15 (-34.78%)
Mutual labels:  annotations, annotation-processor
spring4-hibernate5-example
Spring 4 and Hibernate 5 integration example using annotations.
Stars: ✭ 16 (-30.43%)
Mutual labels:  annotations
SingleFile-Lite
Feel the power of the Manifest V3. The future, right now!
Stars: ✭ 55 (+139.13%)
Mutual labels:  annotations

WinAnalytics library

Build Status Deploy Status Download Android Arsenal Gitter GitHub GitHub

A light-weight android library that can be quickly integrated into any app to use analytics tools.

  • Custom adapters for support all analytical tools.
  • Annotations based.
  • Support Retrofit calls for log events automatically.
  • Support log events when user clicks on views.
  • Support screens events.
  • Null safety.

Contributing:

If you'd like to contribute, please take a look at the Contributing page on the Wiki.

Example WinAnalytics:

Application class

public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        WinConfiguration configuration = WinConfiguration.builder()
                .registerAdapter(new MixpanelAdapter(this, "token"))
                .registerAdapter(new FirebaseAdapter(this))
                .registerAdapter(new FabricAdapter(this))
                ...
                .debugMode(BuildConfig.DEBUG)
                .build();
        WinAnalytics.init(configuration);
    }
}

Analytics interfaces

@Analytics(
        events = {
                @Data(value = @Value("post.title"), key = @Key("title")),
                @Data(value = @Value("post.body"), key = @Key("body"))
        },
        timestamp = true
)
public interface MainActivityAnalytics {

    // This event will override class @Analytics events
    @Event(
            value = "Success get posts",
            events = {
                    @Data(value = @Value("post.title"), key = @Key("title")),
                    @Data(value = @Value("otherParam"), key = @Key("otherParam"))
            }
    )
    void successGetPosts(Post post, String otherParam);

    // This event will inherit values from class @Analytics annotation
    @Event(value = "Failed get posts")
    void failedGetPosts(Post post);

    // This event will inherit values from class @Analytics annotation
    @Event(value = "Failed get posts1")
    void failed1GetPosts(Post post);
}

Analytics wrapper

@AnalyticsWrapper
public interface MyAnalyticsWrapper {

    // This method will be return MainActivityAnalytics implementation
    MainActivityAnalytics mainActivityAnalytics();
}

Access MyAnalyticsWrapper

public class MainActivity extends AppCompatActivity {

    private JavaMyAnalyticsWrapper wrapper;
    private JavaMainActivityAnalytics mainActivityAnalytics;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        wrapper = WinAnalytics.create(JavaMyAnalyticsWrapper.class);
        mainActivityAnalytics = wrapper.mainActivityAnalytics();

        Post post = new Post();
        post.setTitle("title");
        post.setBody("body");

        mainActivityAnalytics.failedGetPosts(post);
    }
}

Example analytics when user clicks on button:

Analytics interface

@Analytics
public interface JavaMainActivityAnalytics {

    @Event(
            value = "Failed get posts",
            events = {
                    @Data(value = @Value("post.title"), key = @Key("title"))
            },
            timestamp = true
    )
    void failedGetPosts(/* This name for WinAnalytics know whitch object will bind here */ @Name("post") Post post);
}

MainActivity

public class MainActivity extends AppCompatActivity {

    private Destroyable destroyable;

    @Name("post")
    @Bind(R.id.btn_login)
    Post post;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Don't forget add this line to bind clicks listeners to views
        destroyable = WinAnalytics.bind(this);
    }

    @EventOnClick(value = R.id.btn_login, event = "Failed get posts")
    void onLoginClicked() {
        // Do what you want here after user clicks on button and WinAnalytics will log event automatically for you
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        destroyable.destroy();
    }
}

Network analytics

What if you want log events based on retrofit call success or failure, WinAnalytics already supports this type of analytics.

Http client

public interface HttpClient {

    // This for tell WinAnalytisc this call supports analytics
    @AnalyticsCall
    @GET("posts")
    Call<List<Post>> getPosts();
}

then after add @Analytics for your call you need to specify what event you want to call when this call response success or failure

Analytics interface

@Analytics
public interface JavaMainActivityAnalytics {

    // That means this analyics will fire after "posts" api response success and "name" means you should use call arguments which named with "getPostsSuccess"
    @CallSuccess(value = "posts", name = "getPostsSuccess")
    @Event(
            value = "Failed get posts",
            events = {
                    @Data(value = @Value("post.title"), key = @Key("title"))
            },
            timestamp = true
    )
    void failedGetPosts(@Name("post") Post post);
}

Now in your activity or whatever you want to log events you need to add this code.

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    // value means your api, and names means name whitch you specifyed in `@CallSuccess`
    @CallArgument(value = {"posts"}, names = "getPostsSuccess")
    Post post;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // You need register and unregister your call arguments and binds
        WinAnalytics.getInstance().register(this);

        findViewById(R.id.btn_login2).setOnClickListener(this);
    }

    // this method will return api response for log initialize your variable before log event
    @BindCallArguments(value = {"posts"})
    void init(Response<List<Post>> response) {
        post = response.body().get(0);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        WinAnalytics.getInstance().unregister(this);
    }

    @Override
    public void onClick(View v) {
        HttpHelper.getHttpClient().getPosts().enqueue(new Callback<List<Post>>() {
            @Override
            public void onResponse(@NonNull Call<List<Post>> call, @NonNull Response<List<Post>> response) {
                // Do what you want after response and let WinAnalytics log network events for you
            }

            @Override
            public void onFailure(@NonNull Call<List<Post>> call, @NonNull Throwable t) {
            }
        });
    }
}

The last thing you want to add is indexing interface like this

@AnalyticsIndex
public interface MyAnalyticsIndex { }

Now WinAnalytics will log events automatically for you in a background thread, But you need to register WinAnalytics call adapter factory when you initialize retrofit like this

public static HttpClient getHttpClient() {
    return new Retrofit.Builder()
        .addConverterFactory(GsonConverterFactory.create())
        .addCallAdapterFactory(new AnalyticsFactory(BASE_URL))
        .baseUrl(BASE_URL)
        .build()
        .create(HttpClient.class);
}

Log screens opens events

For log screen events you just want to annotate your class with @Screen like this

@Screen(value = "Main activity", timestamp = true)
public class JavaMainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Don't forget to add this line for log event and bind other cliks if you have.
        WinAnalytics.bind(this);
    }
}

Download

dependencies {
    // if you want log retroift calls events you need to add this dependency
    implementation 'com.winfooz:winanalytics-retroft:1.0.0'

    // but if you want just log clicks events or manually events you need to add this dependency
    implementation 'com.winfooz:winanalytics:1.0.0'

    // Always you need to add this dependency.
    kapt 'com.winfooz:winanalytics-compiler:1.0.0'
    
    // If you want use firebase analytics
    implementation 'com.winfooz:adapter-firebase:1.0.0'
    
    // If you want use mixpanel analytics
    implementation 'com.winfooz:adapter-mixpanel:1.0.0'
}

Support annotations

@Analytics
@AnalyticsCall
@AnalyticsIndex
@AnalyticsWrapper
@Bind
@BindCallArguments
@CallArgument
@CallFailure
@CallSuccess
@Event
@EventOnClick
@Name
@Screen

License

WinAnalytics is released under the MIT license. See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].