Search code examples
androidevent-trackinggoogle-fabric

How to track number of clicks of a button in Fabric analytics


I'm using fabrics in my app, I'm getting crash reports and user activities in my app, but I want to track a event example button click event in android. How many times the button is clicked in a session for android.

can I get these details using Fabric


Solution

  • You can use logCustom in Answer.

    For custom events

    Answers.getInstance().logCustom(new CustomEvent("myButtonClicked"));
    

    For Custom events with attributes:

    Answers.getInstance().logCustom(new CustomEvent("myButtonClicked")
          .putCustomAttribute("Param1", "XXXX")
          .putCustomAttribute("Param2", "YYY"));