{"id":2477,"date":"2017-07-21T11:22:09","date_gmt":"2017-07-21T09:22:09","guid":{"rendered":"http:\/\/mariusbancila.ro\/blog\/?p=2477"},"modified":"2017-07-21T11:22:09","modified_gmt":"2017-07-21T09:22:09","slug":"using-google-firebase-in-cordova-apps","status":"publish","type":"post","link":"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/","title":{"rendered":"Using Google Firebase in Cordova apps"},"content":{"rendered":"<p><a href=\"https:\/\/firebase.google.com\/\" target=\"_blank\">Firebase<\/a> is a platform for developing mobile and web application that provides analytics, authentication, real-time databases, notifications, cloud messaging, crash reporting and other services for your application. In this post, I will discuss how to use the Firebase Analytics in Cordova applications for measuring app usage and user engagement.<\/p>\n<h2>Analytics for Firebase<\/h2>\n<p>This is a free service that can be used for both Android and iOS applications. It provides unlimited reporting of up to 500 distinct events and a number of user properties. <\/p>\n<p>Events allow you to see what happens in an application, such as user actions, system events, or errors. There is a number of <a href=\"https:\/\/support.google.com\/firebase\/answer\/6317485\" target=\"_blank\">automatically collected events<\/a> and you can define your own events. However, you have to keep in mind that:<\/p>\n<ul>\n<li>there is a limit of 500 distinct events that can be reported.<\/li>\n<li>each event can have up to 25 parameters associated with it.<\/li>\n<li>event names can be up to 40 characters long, may only contain alphanumeric characters and underscores (&#8220;_&#8221;), and must start with an alphabetic character.<\/li>\n<li>&#8220;firebase_&#8221;, &#8220;google_&#8221; and &#8220;ga_&#8221; prefixes are reserved and cannot be used.<\/li>\n<li>names are case-sensitive and logging two events whose names differ only in case will result in two distinct events.<\/li>\n<\/ul>\n<p>See <a href=\"https:\/\/firebase.google.com\/docs\/reference\/android\/com\/google\/firebase\/analytics\/FirebaseAnalytics.Event\" target=\"_blank\">FirebaseAnalytics.Event<\/a> for more information.<\/p>\n<p>User properties are information about the user that is recorded together with the events. Default collected user properties include user info (age, gender, country, language, interests), device info (brand, category, model) and app info (version, app store, first open time, new\/established). <\/p>\n<p>Appart from the implicitly collected user properties you can define your own. For that, however, you must use the Firebase console. You must be careful with the properties that you add because for now these cannot be renamed or deleted (you can only change their description).<br \/>\n<a href=\"http:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_userproperties1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_userproperties1-1024x266.png\" alt=\"\" width=\"1024\" height=\"266\" class=\"alignnone size-large wp-image-2478\" srcset=\"https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_userproperties1-1024x266.png 1024w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_userproperties1-300x78.png 300w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_userproperties1-768x199.png 768w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_userproperties1.png 1091w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<h2>Getting started<\/h2>\n<p>To be able to use Firebase for your Android or iOS app you need to enroll it. For that, you must create a project and then add applications to it.<\/p>\n<ol>\n<li>Open the <a href=\"https:\/\/console.firebase.google.com\" target=\"_blank\">Firebase console<\/a>.<\/li>\n<li>Create a new project (or select an existing one).<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_createproj.png\" alt=\"\" width=\"727\" height=\"476\" class=\"alignnone size-full wp-image-2481\" srcset=\"https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_createproj.png 727w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_createproj-300x196.png 300w\" sizes=\"auto, (max-width: 727px) 100vw, 727px\" \/><\/li>\n<li>Add a new Android, iOS or web app.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_addappstart.png\" alt=\"\" width=\"309\" height=\"278\" class=\"alignnone size-full wp-image-2482\" srcset=\"https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_addappstart.png 309w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_addappstart-300x270.png 300w\" sizes=\"auto, (max-width: 309px) 100vw, 309px\" \/><\/li>\n<li>Follow to instructions to register the app, download the config files or perform other necessary setups.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_addapp.png\" alt=\"\" width=\"695\" height=\"551\" class=\"alignnone size-full wp-image-2483\" srcset=\"https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_addapp.png 695w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_addapp-300x238.png 300w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/li>\n<\/ol>\n<p>If you need more help for setting up your app read the Firebase documentation or additional web resources.<\/p>\n<h2>Cordova plugin<\/h2>\n<p>There is an official Cordova plugin called <a href=\"https:\/\/www.npmjs.com\/package\/cordova-plugin-firebase\" target=\"_blank\">cordova-plugin-firebase<\/a> that provides push notifications, analytics, event tracking, crash reporting and other services from the Firebase platform for you Cordova application.<\/p>\n<p>When you start using Firebase, make sure you have the <a href=\"https:\/\/support.google.com\/firebase\/answer\/7015592\" target=\"_blank\">config files properly setup<\/a> (present and valid). Otherwise, your app will crash on boot or Firebase features won&#8217;t work.<\/p>\n<h2>Recording events and user properties<\/h2>\n<p>To record a user property you should call <tt>setUserProperty<\/tt>. This has the form:<\/p>\n<pre class=\"lang:js decode:true \" >window.FirebasePlugin.setUserProperty(\"name\", \"value\");<\/pre>\n<p>The name is the case-sensitive name you defined in the Firebase console. In the example above the name was <tt>login_type<\/tt> and possible values were <tt>demo<\/tt> and <tt>live<\/tt>. The purpose of this is to indicate that for an application that supports a demo mode where the users don&#8217;t have to create an account to try the app, the user is either properly authenticated on or actually using the demo feature.<\/p>\n<pre class=\"lang:js decode:true \" >\r\nif ($window && $window['FirebasePlugin']) {\r\n  $window['FirebasePlugin'].setUserProperty('logon_type', 'demo');\r\n}\r\n<\/pre>\n<p>When this call is made the Debug view shows the change of the user property value in the live stream.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_userproperties2.png\" alt=\"\" width=\"1243\" height=\"348\" class=\"alignnone size-full wp-image-2486\" srcset=\"https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_userproperties2.png 1243w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_userproperties2-300x84.png 300w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_userproperties2-768x215.png 768w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_userproperties2-1024x287.png 1024w\" sizes=\"auto, (max-width: 1243px) 100vw, 1243px\" \/><br \/>\nIf you look at the recorded user properties for all following events you will see the <tt>logon_type<\/tt> with the <tt>demo<\/tt> value attached to it.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_userproperties3.png\" alt=\"\" width=\"324\" height=\"198\" class=\"alignnone size-full wp-image-2487\" srcset=\"https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_userproperties3.png 324w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_userproperties3-300x183.png 300w\" sizes=\"auto, (max-width: 324px) 100vw, 324px\" \/><\/p>\n<p>As mentioned ealier, there are a series of events that are automatically recorded. These include <tt>screen_view<\/tt> (collected whenever the page has changed) and <tt>user_engagement<\/tt> (collected periodically when the app is in foreground). However, you can send any other event, each with any number of parameters. To record events you must use the <tt>logEvent<\/tt> function that has the following form:<\/p>\n<pre class=\"lang:js decode:true \" >\r\nwindow.FirebasePlugin.logEvent(\"event\", {param1: \"...\", param2: \"...\"});\r\n<\/pre>\n<p>Let&#8217;s suppose that in your app users can bookmark items (whatever those items might be) but also remove them from the bookmarks (or favorites). You want to record the event of adding and removing an item. You can define an event called <tt>favorites_action<\/tt> with two parameters: <tt>action<\/tt> that can be either <tt>add<\/tt> or <tt>remove<\/tt>, and <tt>type<\/tt>, that indicates what kind of item was added or removed.<\/p>\n<pre class=\"lang:js decode:true \" >\r\nif ($window && $window['FirebasePlugin']) {\r\n  $window['FirebasePlugin'].logEvent(\"favorites_action\", { action: 'add', type: 'business'});\r\n}\r\n<\/pre>\n<p>These are added automatically to the stream of events, recorded with both the the auto collected and user defined parameters and user properties.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_favs1.png\" alt=\"\" width=\"1027\" height=\"355\" class=\"alignnone size-full wp-image-2489\" srcset=\"https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_favs1.png 1027w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_favs1-300x104.png 300w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_favs1-768x265.png 768w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_favs1-1024x354.png 1024w\" sizes=\"auto, (max-width: 1027px) 100vw, 1027px\" \/><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_favs2.png\" alt=\"\" width=\"652\" height=\"335\" class=\"alignnone size-full wp-image-2490\" srcset=\"https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_favs2.png 652w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_favs2-300x154.png 300w\" sizes=\"auto, (max-width: 652px) 100vw, 652px\" \/><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_favs3.png\" alt=\"\" width=\"655\" height=\"355\" class=\"alignnone size-full wp-image-2491\" srcset=\"https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_favs3.png 655w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_favs3-300x163.png 300w\" sizes=\"auto, (max-width: 655px) 100vw, 655px\" \/><\/p>\n<p>All the events have several implicit parameters, including <tt>firebase_screen<\/tt>, <tt>firebase_screen_class<\/tt>, and <tt>firebase_screen_id<\/tt>. Screen class is the class name of the Activity, and the ID is a numerical ID that is probably hard to use to figure where the event came from. The screen name on the other hand (<tt>firebase_screen<\/tt>) is what you probably want to look at. This can be set with a call to <tt>setScreenName<\/tt>. All events will have the param <tt>firebase_screen<\/tt> set to the last value passed to <tt>setScreenName<\/tt>. Therefore, you probably want to make this call whenever the user opens a new page in your application. The call has the form:<\/p>\n<pre class=\"lang:js decode:true \" >\r\nwindow.FirebasePlugin.setScreenName(\"name\");\r\n<\/pre>\n<p>Here is an example:<\/p>\n<pre class=\"lang:js decode:true \" >\r\nif ($window && $window['FirebasePlugin']) {\r\n  $window['FirebasePlugin'].setScreenName('Bookmarks');\r\n}\r\n<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_screen.png\" alt=\"\" width=\"324\" height=\"284\" class=\"alignnone size-full wp-image-2493\" srcset=\"https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_screen.png 324w, https:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_screen-300x263.png 300w\" sizes=\"auto, (max-width: 324px) 100vw, 324px\" \/><\/p>\n<h2>Debugging Firebase Analytics<\/h2>\n<p>The events recorded by Firebase are not instantly sent to the servers. Instead they are cached, archived and periodically dispatched. However, you can enable live streaming of events for debugging purposes, both on Android and iOS. This was used for all the screen shots used previously.<\/p>\n<p>For Android devices:<\/p>\n<ul>\n<li>To enable execute:\n<pre>\r\nadb shell setprop debug.firebase.analytics.app <package_name>\r\n<\/pre>\n<\/li>\n<li>To disable execute:\n<pre>\r\nadb shell setprop debug.firebase.analytics.app .none.\r\n<\/pre>\n<\/li>\n<\/ul>\n<p>For iOS devices:<\/p>\n<ul>\n<li>To enable specify <tt>-FIRDebugEnabled<\/tt> as an argument in XCode<\/li>\n<li>To disable specify <tt>-FIRDebugDisabled<\/tt> as an argument in XCode<\/li>\n<\/ul>\n<p>For more information see <a href=\"https:\/\/firebase.google.com\/docs\/analytics\/debugview\" target=\"_blank\">Debugging Events<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Firebase is a platform for developing mobile and web application that provides analytics, authentication, real-time databases, notifications, cloud messaging, crash reporting and other services for your application. In this post, I will discuss how to use the Firebase Analytics in Cordova applications for measuring app usage and user engagement. Analytics for Firebase This is a &#8230; <a title=\"Using Google Firebase in Cordova apps\" class=\"read-more\" href=\"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/\" aria-label=\"Read more about Using Google Firebase in Cordova apps\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","advgb_blocks_editor_width":"","advgb_blocks_columns_visual_guide":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[417,402,466,439,416],"tags":[517,420,419,516,131,441,443],"class_list":["post-2477","post","type-post","status-publish","format-standard","hentry","category-android","category-apps","category-cordova","category-ios","category-mobile","tag-analytics","tag-android-2","tag-cordova","tag-firebase","tag-google","tag-ios","tag-mobile"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"description\" content=\"A walkthrough for integrating the Google Firebase platform in your Cordova mobile apps for providing analytics of app usage and user engagement.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Marius Bancila\"\/>\n\t<meta name=\"keywords\" content=\"cordova,android,ios,google,firebase,analytics,mobile\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Marius Bancila&#039;s Blog | About code. Mostly on C++\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Using Google Firebase in Cordova apps\" \/>\n\t\t<meta property=\"og:description\" content=\"A walkthrough for integrating the Google Firebase platform in your Cordova mobile apps for providing analytics of app usage and user engagement.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2017-07-21T09:22:09+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2017-07-21T09:22:09+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Using Google Firebase in Cordova apps\" \/>\n\t\t<meta name=\"twitter:description\" content=\"A walkthrough for integrating the Google Firebase platform in your Cordova mobile apps for providing analytics of app usage and user engagement.\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2017\\\/07\\\/21\\\/using-google-firebase-in-cordova-apps\\\/#article\",\"name\":\"Using Google Firebase in Cordova apps\",\"headline\":\"Using Google Firebase in Cordova apps\",\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"http:\\\/\\\/mariusbancila.ro\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/07\\\/gfire_userproperties1-1024x266.png\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2017\\\/07\\\/21\\\/using-google-firebase-in-cordova-apps\\\/#articleImage\"},\"datePublished\":\"2017-07-21T11:22:09+02:00\",\"dateModified\":\"2017-07-21T11:22:09+02:00\",\"inLanguage\":\"en-US\",\"commentCount\":3,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2017\\\/07\\\/21\\\/using-google-firebase-in-cordova-apps\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2017\\\/07\\\/21\\\/using-google-firebase-in-cordova-apps\\\/#webpage\"},\"articleSection\":\"Android, Apps, Cordova, iOS, Mobile, analytics, android, cordova, firebase, google, ios, mobile\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2017\\\/07\\\/21\\\/using-google-firebase-in-cordova-apps\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/mobile\\\/#listItem\",\"name\":\"Mobile\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/mobile\\\/#listItem\",\"position\":2,\"name\":\"Mobile\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/mobile\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/mobile\\\/android\\\/#listItem\",\"name\":\"Android\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/mobile\\\/android\\\/#listItem\",\"position\":3,\"name\":\"Android\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/mobile\\\/android\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2017\\\/07\\\/21\\\/using-google-firebase-in-cordova-apps\\\/#listItem\",\"name\":\"Using Google Firebase in Cordova apps\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/mobile\\\/#listItem\",\"name\":\"Mobile\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2017\\\/07\\\/21\\\/using-google-firebase-in-cordova-apps\\\/#listItem\",\"position\":4,\"name\":\"Using Google Firebase in Cordova apps\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/mobile\\\/android\\\/#listItem\",\"name\":\"Android\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\",\"name\":\"Marius Bancila's Blog\",\"description\":\"About code. Mostly on C++\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/\",\"name\":\"Marius Bancila\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2017\\\/07\\\/21\\\/using-google-firebase-in-cordova-apps\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a84dd2831d955c38355ddea55df4df260809b88f36408bc14fd4eab8f7f131c9?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Marius Bancila\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2017\\\/07\\\/21\\\/using-google-firebase-in-cordova-apps\\\/#webpage\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2017\\\/07\\\/21\\\/using-google-firebase-in-cordova-apps\\\/\",\"name\":\"Using Google Firebase in Cordova apps\",\"description\":\"A walkthrough for integrating the Google Firebase platform in your Cordova mobile apps for providing analytics of app usage and user engagement.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2017\\\/07\\\/21\\\/using-google-firebase-in-cordova-apps\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"datePublished\":\"2017-07-21T11:22:09+02:00\",\"dateModified\":\"2017-07-21T11:22:09+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/\",\"name\":\"Marius Bancila's Blog\",\"description\":\"About code. Mostly on C++\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Using Google Firebase in Cordova apps","description":"A walkthrough for integrating the Google Firebase platform in your Cordova mobile apps for providing analytics of app usage and user engagement.","canonical_url":"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/","robots":"max-image-preview:large","keywords":"cordova,android,ios,google,firebase,analytics,mobile","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/#article","name":"Using Google Firebase in Cordova apps","headline":"Using Google Firebase in Cordova apps","author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"publisher":{"@id":"https:\/\/mariusbancila.ro\/blog\/#organization"},"image":{"@type":"ImageObject","url":"http:\/\/mariusbancila.ro\/blog\/wp-content\/uploads\/2017\/07\/gfire_userproperties1-1024x266.png","@id":"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/#articleImage"},"datePublished":"2017-07-21T11:22:09+02:00","dateModified":"2017-07-21T11:22:09+02:00","inLanguage":"en-US","commentCount":3,"mainEntityOfPage":{"@id":"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/#webpage"},"isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/#webpage"},"articleSection":"Android, Apps, Cordova, iOS, Mobile, analytics, android, cordova, firebase, google, ios, mobile"},{"@type":"BreadcrumbList","@id":"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/#listItem","position":1,"name":"Home","item":"https:\/\/mariusbancila.ro\/blog\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/#listItem","name":"Mobile"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/#listItem","position":2,"name":"Mobile","item":"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/android\/#listItem","name":"Android"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/android\/#listItem","position":3,"name":"Android","item":"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/android\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/#listItem","name":"Using Google Firebase in Cordova apps"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/#listItem","name":"Mobile"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/#listItem","position":4,"name":"Using Google Firebase in Cordova apps","previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/android\/#listItem","name":"Android"}}]},{"@type":"Organization","@id":"https:\/\/mariusbancila.ro\/blog\/#organization","name":"Marius Bancila's Blog","description":"About code. Mostly on C++","url":"https:\/\/mariusbancila.ro\/blog\/"},{"@type":"Person","@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author","url":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/","name":"Marius Bancila","image":{"@type":"ImageObject","@id":"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/a84dd2831d955c38355ddea55df4df260809b88f36408bc14fd4eab8f7f131c9?s=96&d=mm&r=g","width":96,"height":96,"caption":"Marius Bancila"}},{"@type":"WebPage","@id":"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/#webpage","url":"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/","name":"Using Google Firebase in Cordova apps","description":"A walkthrough for integrating the Google Firebase platform in your Cordova mobile apps for providing analytics of app usage and user engagement.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/#breadcrumblist"},"author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"creator":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"datePublished":"2017-07-21T11:22:09+02:00","dateModified":"2017-07-21T11:22:09+02:00"},{"@type":"WebSite","@id":"https:\/\/mariusbancila.ro\/blog\/#website","url":"https:\/\/mariusbancila.ro\/blog\/","name":"Marius Bancila's Blog","description":"About code. Mostly on C++","inLanguage":"en-US","publisher":{"@id":"https:\/\/mariusbancila.ro\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Marius Bancila's Blog | About code. Mostly on C++","og:type":"article","og:title":"Using Google Firebase in Cordova apps","og:description":"A walkthrough for integrating the Google Firebase platform in your Cordova mobile apps for providing analytics of app usage and user engagement.","og:url":"https:\/\/mariusbancila.ro\/blog\/2017\/07\/21\/using-google-firebase-in-cordova-apps\/","article:published_time":"2017-07-21T09:22:09+00:00","article:modified_time":"2017-07-21T09:22:09+00:00","twitter:card":"summary","twitter:title":"Using Google Firebase in Cordova apps","twitter:description":"A walkthrough for integrating the Google Firebase platform in your Cordova mobile apps for providing analytics of app usage and user engagement."},"aioseo_meta_data":{"post_id":"2477","title":"Using Google Firebase in Cordova apps","description":"A walkthrough for integrating the Google Firebase platform in your Cordova mobile apps for providing analytics of app usage and user engagement.","keywords":[{"label":"cordova","value":"cordova"},{"label":"android","value":"android"},{"label":"ios","value":"ios"},{"label":"google","value":"google"},{"label":"firebase","value":"firebase"},{"label":"analytics","value":"analytics"},{"label":"mobile","value":"mobile"}],"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-03-18 21:06:01","updated":"2025-12-12 07:46:59","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"author_meta":{"display_name":"Marius Bancila","author_link":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/"},"featured_img":null,"jetpack_publicize_connections":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Marius Bancila","author_link":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/"},"uagb_comment_info":3,"uagb_excerpt":"Firebase is a platform for developing mobile and web application that provides analytics, authentication, real-time databases, notifications, cloud messaging, crash reporting and other services for your application. In this post, I will discuss how to use the Firebase Analytics in Cordova applications for measuring app usage and user engagement. Analytics for Firebase This is a&hellip;","coauthors":[],"tax_additional":{"categories":{"linked":["<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/android\/\" class=\"advgb-post-tax-term\">Android<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/apps\/\" class=\"advgb-post-tax-term\">Apps<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/cordova\/\" class=\"advgb-post-tax-term\">Cordova<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/ios\/\" class=\"advgb-post-tax-term\">iOS<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/\" class=\"advgb-post-tax-term\">Mobile<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">Android<\/span>","<span class=\"advgb-post-tax-term\">Apps<\/span>","<span class=\"advgb-post-tax-term\">Cordova<\/span>","<span class=\"advgb-post-tax-term\">iOS<\/span>","<span class=\"advgb-post-tax-term\">Mobile<\/span>"]},"tags":{"linked":["<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/\" class=\"advgb-post-tax-term\">analytics<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/\" class=\"advgb-post-tax-term\">android<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/\" class=\"advgb-post-tax-term\">cordova<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/\" class=\"advgb-post-tax-term\">firebase<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/\" class=\"advgb-post-tax-term\">google<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/\" class=\"advgb-post-tax-term\">ios<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/mobile\/\" class=\"advgb-post-tax-term\">mobile<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">analytics<\/span>","<span class=\"advgb-post-tax-term\">android<\/span>","<span class=\"advgb-post-tax-term\">cordova<\/span>","<span class=\"advgb-post-tax-term\">firebase<\/span>","<span class=\"advgb-post-tax-term\">google<\/span>","<span class=\"advgb-post-tax-term\">ios<\/span>","<span class=\"advgb-post-tax-term\">mobile<\/span>"]}},"comment_count":"3","relative_dates":{"created":"Posted 9 years ago","modified":"Updated 9 years ago"},"absolute_dates":{"created":"Posted on July 21, 2017","modified":"Updated on July 21, 2017"},"absolute_dates_time":{"created":"Posted on July 21, 2017 11:22 am","modified":"Updated on July 21, 2017 11:22 am"},"featured_img_caption":"","series_order":"","jetpack_shortlink":"https:\/\/wp.me\/pYNdv-DX","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/2477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/comments?post=2477"}],"version-history":[{"count":12,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/2477\/revisions"}],"predecessor-version":[{"id":2499,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/2477\/revisions\/2499"}],"wp:attachment":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/media?parent=2477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/categories?post=2477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/tags?post=2477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}