Cordova-plugin-firebase: Analytics not shown anything

Created on 15 Jun 2017  路  6Comments  路  Source: arnesson/cordova-plugin-firebase

hello dears

I have Cordova 6.4.0 and JQuery mobile framework

I installed the firebase and setup all the config and check it many times

some features are working such as (setBade,getToken) but the live Analytics and logEvent not working

I checked the XCode debug and no error at all from firebase side

I included the .info list, added the adSupport framework, i added these line in native code also:

#import "Firebase.h"
[FIRApp configure];

and still same issue

here is my javascript codes:

          window.FirebasePlugin.subscribe("testing");

           window.FirebasePlugin.logEvent("page_view", {page: "initiator"});


          window.FirebasePlugin.grantPermission();

          window.FirebasePlugin.logEvent("cordova", {content_type: "page_view", item_id: "cordova"});

          window.FirebasePlugin.setBadgeNumber(100);


          window.FirebasePlugin.getToken(function(token) {
                // save this server-side and use it to push notifications to this device
                console.log("Firebase ===>"+token);
            }, function(error) {
                console.error("Firebase ===> failed"+error);
            });

^^ it's all on DeviceReady event

here is some XCode showing all success:

2017-06-15 15:44:43.626 Ajeer-Client[712] <Notice> [Firebase/Crash][I-CRA000004] Successfully initialized
2017-06-15 15:44:43.731 Ajeer-Client[712] <Notice> [Firebase/Analytics][I-ACS023007] Firebase Analytics v.3700000 started
2017-06-15 15:44:43.731 Ajeer-Client[712] <Notice> [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
2017-06-15 15:44:45.094 Ajeer-Client[712] <Notice> [Firebase/Analytics][I-ACS023012] Firebase Analytics enabled

so whats next !! do i need to upload the app to production in order to get the traffic?

Most helpful comment

I found the problem. The streamview isn`t a realtime view, the data are aggregated and send only one time per hour in a bulk.
You can see this in a console with

adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC

All 6 comments

Have you added -FIRAnalyticsDebugEnabled as the logging suggests?
Are you looking in the firebase DebugView?

I have a similar problem on Android.
I want to track the pages and use
window.FirebasePlugin.logEvent("page_view", {page: 'testpage'});
If I look in firebase at the streamview, there is nothing. But if I uninstall my app, every pageview from last install are at firebase at the same minute.
The data is apparently only send at an installation or after uninstall to firebase. I would expect, that the data is send at every event.
My Plugin List:

com-sarriaroman-photoviewer 1.1.10 "PhotoViewer"
com.phonegap.plugins.nativesettingsopener 1.3.0 "Native settings"
com.phonegap.plugins.OrientationLock 0.1 "OrientationLock"
cordova-admob-sdklibs 2.1.4 "Google Mobile Ads SDK for Cordova"
cordova-connectivity-monitor 1.2.2 "Connectivity Monitoring"
cordova-custom-config 4.0.2 "cordova-custom-config"
cordova-plugin-admob-simple 3.3.4 "Cordova-Phonegap AdMob Plugin"
cordova-plugin-app-event 1.2.0 "Application Events"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-device 1.1.6 "Device"
cordova-plugin-dialogs 1.3.3 "Notification"
cordova-plugin-facebook4 1.9.1 "Facebook Connect"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-firebase 0.1.21 "Google Firebase Plugin"
cordova-plugin-google-analytics 1.8.2 "Google Universal Analytics Plugin"
cordova-plugin-googleplus 5.1.1 "Google SignIn"
cordova-plugin-inappbrowser 1.7.1 "InAppBrowser"
cordova-plugin-native-keyboard 1.3.2 "Native Keyboard"
cordova-plugin-network-information 1.3.3 "Network Information"
cordova-plugin-screen-orientation 2.0.1 "Screen Orientation"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.3 "StatusBar"
cordova-plugin-whitelist 1.3.2 "Whitelist"
cordova-plugin-x-socialsharing 5.1.8 "SocialSharing"
cordova-universal-links-plugin 1.2.1 "Universal Links Plugin"
es6-promise-plugin 4.1.0 "Promise"
phonegap-plugin-push 1.10.5 "PushPlugin"

Is having both

cordova-plugin-firebase 0.1.21 "Google Firebase Plugin"
cordova-plugin-google-analytics 1.8.2 "Google Universal Analytics Plugin"

an issue? Firebase contains Analytics, so maybe there is some conflict going on?

I try the same with ionic.

ionic start myApp tabs
ionic cordova platform add android
ionic cordova plugin add cordova-plugin-firebase
npm install --save @ionic-native/firebase

Then I add in the root folder the google-services.json file.

My app.module.ts

import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { Firebase } from '@ionic-native/firebase';

import { AboutPage } from '../pages/about/about';
import { ContactPage } from '../pages/contact/contact';
import { HomePage } from '../pages/home/home';
import { TabsPage } from '../pages/tabs/tabs';

import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

@NgModule({
  declarations: [
    MyApp,
    AboutPage,
    ContactPage,
    HomePage,
    TabsPage
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    AboutPage,
    ContactPage,
    HomePage,
    TabsPage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    Firebase
  ]
})
export class AppModule {}

My src/pages/home.ts

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Firebase } from '@ionic-native/firebase';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  constructor(public navCtrl: NavController, private firebase: Firebase) {

  }

  ionViewWillEnter() {
    this.firebase.getToken()
    .then(token => console.log(`The token is ${token}`)) // save the token server-side and use it to push notifications to this device
    .catch(error => console.error('Error getting token', error));
    let d = new Date(); 
    this.firebase.logEvent("page_view", {page: 'Home '+d.getHours()+":"+d.getMinutes()+":"+d.getSeconds()});
    console.log('after page_view '+d.getHours()+":"+d.getMinutes()+":"+d.getSeconds());
  }

  ionViewDidLoad() {

  }

}

The result is, that I have a token in my console and I see "after page_view ...". But there are no events in the streamview. After uninstall the app, all events are transfered.

I found the problem. The streamview isn`t a realtime view, the data are aggregated and send only one time per hour in a bulk.
You can see this in a console with

adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC

I found the problem. The streamview isn`t a realtime view, the data are aggregated and send only one time per hour in a bulk.
You can see this in a console with

adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC

so do you have any solution ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danielpalen picture danielpalen  路  5Comments

matthitachi picture matthitachi  路  5Comments

michaelreiser picture michaelreiser  路  5Comments

arunkatariaoodles picture arunkatariaoodles  路  4Comments

Zrnik picture Zrnik  路  3Comments