Project

General

Profile

« Previous | Next » 

Revision 9f3a6813

Added by Leszek Koltunski about 4 years ago

Improve Analytics reports

View differences:

src/main/java/org/distorted/main/RubikPreRender.java
338 338

  
339 339
  private void reportRecord()
340 340
    {
341
    RubikStatePlay play = (RubikStatePlay) StateList.PLAY.getStateClass();
342
    RubikScores scores = RubikScores.getInstance();
343

  
344
    int object      = play.getObject();
345
    int size        = play.getSize();
346
    int level       = play.getLevel();
347
    ObjectList list = ObjectList.getObject(object);
348
    String name     = scores.getName();
349

  
350
    String record = list.name()+"_"+size+" level "+level+" time "+mNewRecord+" isNew: "+mIsNewRecord+" name: "+name;
351

  
352 341
    final RubikActivity act = (RubikActivity)mView.getContext();
353 342
    FirebaseAnalytics analytics = act.getAnalytics();
354 343

  
355 344
    if( analytics!=null )
356 345
      {
346
      RubikStatePlay play = (RubikStatePlay) StateList.PLAY.getStateClass();
347
      RubikScores scores = RubikScores.getInstance();
348

  
349
      int object      = play.getObject();
350
      int size        = play.getSize();
351
      int level       = play.getLevel();
352
      ObjectList list = ObjectList.getObject(object);
353
      String name     = scores.getName();
354

  
355
      String record = list.name()+"_"+size+" level "+level+" time "+mNewRecord+" isNew: "+mIsNewRecord;
356

  
357 357
      Bundle bundle = new Bundle();
358
      bundle.putString(FirebaseAnalytics.Param.CHARACTER, name);
358 359
      bundle.putString(FirebaseAnalytics.Param.LEVEL, record);
359
      analytics.logEvent(FirebaseAnalytics.Event.LEVEL_END, bundle);
360
      analytics.logEvent(FirebaseAnalytics.Event.LEVEL_UP, bundle);
360 361
      }
361 362
    }
362 363

  
......
410 411
          else
411 412
            {
412 413
            String name = scores.getName();
413
            analyticsReport(act,"Request review flow not successful", name, timeBegin);
414
            analyticsReport(act,"Request Review Flow not successful", name, timeBegin);
414 415
            }
415 416
          }
416 417
        });
......
422 423
  private void analyticsReport(RubikActivity act, String message, String name, long timeBegin)
423 424
    {
424 425
    long elapsed = System.currentTimeMillis() - timeBegin;
426
    String msg = message+" startTime: "+timeBegin+" elapsed: "+elapsed+" name: "+name;
425 427

  
426 428
    if( BuildConfig.DEBUG )
427 429
       {
428
       android.util.Log.d("pre", message);
429
       android.util.Log.d("pre", name);
430
       android.util.Log.d("pre", "startTime: "+timeBegin+" elapsed: "+elapsed);
430
       android.util.Log.d("pre", msg);
431 431
       }
432 432
    else
433 433
      {
......
436 436
      if( analytics!=null )
437 437
        {
438 438
        Bundle bundle = new Bundle();
439
        bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, message);
440
        bundle.putString(FirebaseAnalytics.Param.CHARACTER, name);
441
        bundle.putString(FirebaseAnalytics.Param.START_DATE, "startTime: "+timeBegin+" elapsed: "+elapsed);
442
        analytics.logEvent(FirebaseAnalytics.Event.CAMPAIGN_DETAILS, bundle);
439
        bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, msg);
440
        analytics.logEvent(FirebaseAnalytics.Event.SHARE, bundle);
443 441
        }
444 442
      }
445 443
    }

Also available in: Unified diff