{"id":17588,"date":"2014-12-18T12:09:12","date_gmt":"2014-12-18T10:09:12","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=17588"},"modified":"2023-11-09T15:06:06","modified_gmt":"2023-11-09T13:06:06","slug":"android-google-analytics-v4-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/","title":{"rendered":"Android Google Analytics v4 Example"},"content":{"rendered":"<p>Google Analytics is a service offered by Google that generates detailed statistics about a website&#8217;s traffic and traffic sources. It&#8217;s the most widely used website statistics service. However, nowadays, that mobile applications traffic has increased, detailed statistics from mobile platforms are also very important.<\/p>\n<p>Google Analytics for mobile applications can measure user behavior in your app from installs to engagement and purchases. With Google Analytics platform for mobile applications, we can know what devices user our application, and where they come from and with features like Traffic Sources reports and Google Play integration that show us what brought users to our app.<\/p>\n<p>This is why, Google Analytics is also essential on Android applications. And with this example we are going to elaborate on Google Analytics integration in an Android mobile application.<\/p>\n<p>For our example will use the following tools in a Windows 64-bit or an OS X platform:<\/p>\n<ul>\n<li>JDK 1.7<\/li>\n<li>Eclipse 4.2 Juno<\/li>\n<li>Android SDK 4.4.2<\/li>\n<\/ul>\n<p>Let\u2019s take a closer look:<br \/>\n<span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:515,&quot;3&quot;:{&quot;1&quot;:0},&quot;4&quot;:{&quot;1&quot;:2,&quot;2&quot;:16777215},&quot;12&quot;:0}\">[ulp id=&#8217;XSQzgZ7lDbTb31Tj&#8217;]<\/span><\/p>\n<h2>1. Create a Google Analytics Account<\/h2>\n<p>To begin with, we should create a new Google Analytics Account and subscribe our application in order to get a mobile tracking ID.<\/p>\n<p>In order to use this API, we will have to enter the Google Analytics portal. Visit <a href=\"https:\/\/developers.google.com\/analytics\/devguides\/collection\/android\/v4\/\">Google Analytics SDK v4 for Android platform<\/a> and create an account, or login with your current Google Plus account.<\/p>\n<p><figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsPlatfrom-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13637\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsPlatfrom-1.jpg\" alt=\"Figure 1. Google Analytics SDK v4 for Android - Getting Started Guide\" width=\"800\" height=\"426\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 1. Google Analytics SDK v4 for Android &#8211; Getting Started Guide<\/figcaption><\/figure><\/p>\n<p>After you have created a Google Analytics account you can visit the Google Analytics dashboard by visiting <a href=\"www.google.com\/analytics\/\">www.google.com\/analytics\/<\/a>.<\/p>\n<p><figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsPlatfrom-2.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13637\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsPlatfrom-2.jpg\" alt=\"Figure 2. Create a new Android project\" width=\"800\" height=\"426\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 1. Create a new Android project<\/figcaption><\/figure><\/p>\n<p>Then, we enter to the plaform and we follow the flow in order to obtain the tracking ID:<\/p>\n<p><figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsPlatfrom-3.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13637\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsPlatfrom-3.jpg\" alt=\"Figure 2. Enter Google Analytics dashboard\" width=\"800\" height=\"426\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 2. Enter Google Analytics dashboard<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsPlatfrom-4.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13637\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsPlatfrom-4.jpg\" alt=\"Figure 3. Add a new application for tracking\" width=\"800\" height=\"426\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 3. Add a new application for tracking<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsPlatfrom-5.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13637\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsPlatfrom-5.jpg\" alt=\"Figure 4. Follow the flow of the registration\" width=\"800\" height=\"426\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 4. Follow the flow of the registration<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsPlatfrom-6.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13637\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsPlatfrom-6.jpg\" alt=\"Figure 5. Create a new mobile app tracking account\" width=\"800\" height=\"426\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 5. Create a new mobile app tracking account<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsPlatfrom-7.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13637\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsPlatfrom-7.jpg\" alt=\"Figure 6. It is very important to read and accept the terms\" width=\"800\" height=\"426\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 6. It is very important to read and accept the terms<\/figcaption><\/figure><\/p>\n<h2>2. Create a New Android Application Project<\/h2>\n<div class=\"tip\"><strong>Tip<\/strong><br \/>\nYou may skip project creation and jump directly to the <a href=\"#code\"><strong>beginning of the example<\/strong><\/a> below.<\/div>\n<p>Open Eclipse IDE and go to File \u2192 New \u2192 Project \u2192 Android Application Project.<\/p>\n<p><figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 596px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/08\/AndroidExample1.png\"><img decoding=\"async\" class=\"size-full wp-image-13637\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/08\/AndroidExample1.png\" alt=\"Figure 7. Create a new Android project\" width=\"596\" height=\"559\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/08\/AndroidExample1.png 596w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/08\/AndroidExample1-300x281.png 300w\" sizes=\"(max-width: 596px) 100vw, 596px\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 7. Create a new Android project<\/figcaption><\/figure><\/p>\n<p>Specify the name of the application, the project and the package and then click Next.<\/p>\n<p><figure id=\"attachment_13786\" aria-describedby=\"caption-attachment-13786\" style=\"width: 636px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13786\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-1.jpg\" alt=\"Figure 8. Create a new Android project name\" width=\"636\" height=\"543\" \/><\/a><figcaption id=\"caption-attachment-13786\" class=\"wp-caption-text\">Figure 8. Create a new Android project name<\/figcaption><\/figure><\/p>\n<p>In the next window, the \u201cCreate Activity\u201d option should be checked. The new created activity will be the main activity of your project. Then press Next button.<\/p>\n<p><figure id=\"attachment_11777\" aria-describedby=\"caption-attachment-11777\" style=\"width: 636px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-2.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-13642\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-2.jpg\" alt=\"Figure 9. Configure the project\" width=\"636\" height=\"543\" \/><\/a><figcaption id=\"caption-attachment-11777\" class=\"wp-caption-text\">Figure 9. Configure the project<\/figcaption><\/figure><div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>In \u201cConfigure Launcher Icon\u201d window you should choose the icon you want to have in your app. We will use the default icon of android, so click Next.<\/p>\n<p><figure id=\"attachment_11778\" aria-describedby=\"caption-attachment-11778\" style=\"width: 660px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/08\/AndroidExample4.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-13638\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/08\/AndroidExample4.png\" alt=\"Configure Launcher Icon\" width=\"660\" height=\"590\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/08\/AndroidExample4.png 660w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/08\/AndroidExample4-300x268.png 300w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/a><figcaption id=\"caption-attachment-11778\" class=\"wp-caption-text\">Figure 10. Configure the launcher icon<\/figcaption><\/figure><\/p>\n<p>Select the \u201cBlank Activity\u201d option and press Next.<\/p>\n<p><figure id=\"attachment_11779\" aria-describedby=\"caption-attachment-11779\" style=\"width: 660px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/08\/AndroidExample5.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-13639\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/08\/AndroidExample5.png\" alt=\"Blank Activity\" width=\"660\" height=\"590\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/08\/AndroidExample5.png 660w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/08\/AndroidExample5-300x268.png 300w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/a><figcaption id=\"caption-attachment-11779\" class=\"wp-caption-text\">Figure 11. Create the activity and select its type<\/figcaption><\/figure><\/p>\n<p>You have to specify a name for the new Activity and a name for the layout description of your app. The .xml file for the layout will automatically be created in the res\/layout folder. It will also be created a fragment layout xml, that we are not going to use in this project and you can remove it if you want. Then press Finish.<\/p>\n<p><figure id=\"attachment_13788\" aria-describedby=\"caption-attachment-13788\" style=\"width: 660px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-3.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13788\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-3.jpg\" alt=\"Figure 12. Create a new blank activity\" width=\"660\" height=\"590\" \/><\/a><figcaption id=\"caption-attachment-13788\" class=\"wp-caption-text\">Figure 12. Create a new blank activity<\/figcaption><\/figure><\/p>\n<p>Here you can see, how will the structure of the project become when finished:<\/p>\n<p><figure id=\"attachment_13789\" aria-describedby=\"caption-attachment-13789\" style=\"width: 408px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-4.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13789\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-4.jpg\" alt=\"Figure 13. The tree of the project\" width=\"408\" height=\"525\" \/><\/a><figcaption id=\"caption-attachment-13789\" class=\"wp-caption-text\">Figure 13. The tree of the project<\/figcaption><\/figure><\/p>\n<h2>3. Import Google Play Services in your project<\/h2>\n<p>In order to be able to work with Google Analytics, we have to import the Google Play Services library in the project.<\/p>\n<div class=\"tip\"><strong>Tip<\/strong><br \/>\nGoogle Analytics can be used and will work on devices that do not have Google Play Services. In this case you still have to download and use the Google Play Services SDK and Google Analytics will automatically fall back to local dispatching.<\/div>\n<p>Download Google Play Services SDK. We have to launch Android SDK Manager and install the Google Play services package.<\/p>\n<p><figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-5.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13637\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-5.jpg\" alt=\"Figure 14. Launch Android SDK Manager\" width=\"800\" height=\"426\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 14. Launch Android SDK Manager<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 740px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-6.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13637\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-6.jpg\" alt=\"Figure 15. Download Google Play Services library\" width=\"740\" height=\"470\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 15. Download Google Play Services library<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 525px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-7.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13637\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-7.jpg\" alt=\"Figure 16. Import the library as an existing Android project\" width=\"525\" height=\"550\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 16. Import the library as an existing Android project<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 626px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-8.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13637\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-8.jpg\" alt=\"Figure 17. Import the library as an existing Android project\" width=\"626\" height=\"728\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 17. Import the library as an existing Android project<\/figcaption><\/figure><\/p>\n<p>After downloading the Google Play Service package, just import this project into the main GoogleAnalyticsExample project.<\/p>\n<p><figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 801px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-9.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13637\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-9.jpg\" alt=\"Figure 18. Import the library into the main GoogleAnalyticsExample project\" width=\"801\" height=\"728\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 18. Import the library into the main GoogleAnalyticsExample project<\/figcaption><\/figure><\/p>\n<h2>4. Creating the layout of the main GoogleAnalyticsExample<\/h2>\n<p>We are going to make a super simple layout xml for the <code>GoogleAnalyticsExample.class<\/code>, we will basically use the default layout, that is created by Eclipse IDE, because in this example we will not add any buttons or other layouts.<\/p>\n<p>Open <code>res\/layout\/activity_main.xml<\/code>, go to the respective xml tab and paste the following:<\/p>\n<p><em><span style=\"text-decoration: underline;\">activity_main.xml<\/span><\/em><\/p>\n<pre class=\"brush:xml; wrap-lines:false;\">&lt;FrameLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\n    android:id=\"@+id\/container\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\"com.javacodegeeks.googleanalyticsexample.GoogleAnalyticsExample\" \/&gt;\n<\/pre>\n<h2>5. Creating the source code of the main GoogleAnalyticsExample Activity<\/h2>\n<p>Open <code>src\/com.javacodegeeks.googleanalyticsexample\/GoogleAnalyticsExample.java<\/code> file and paste the code below.<\/p>\n<p><em><span style=\"text-decoration: underline;\">GoogleAnalyticsExample.java<\/span><\/em>[ulp id='XSQzgZ7lDbTb31Tj']<\/p>\n<pre class=\"brush:java; wrap-lines:false\">package com.javacodegeeks.googleanalyticsexample;\n\nimport android.app.Activity;\nimport android.os.Bundle;\n\nimport com.google.android.gms.analytics.GoogleAnalytics;\nimport com.google.android.gms.analytics.HitBuilders;\nimport com.google.android.gms.analytics.Tracker;\nimport com.javacodegeeks.googleanalyticsexample.GoogleAnalyticsApp.TrackerName;\n\npublic class GoogleAnalyticsExample extends Activity {\n\n\t@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.activity_main);\n\n\t\tTracker t = ((GoogleAnalyticsApp) getApplication()).getTracker(TrackerName.APP_TRACKER);\n\t\tt.setScreenName(\"Home\");\n\t\tt.send(new HitBuilders.AppViewBuilder().build());\n\t}\n\n\t@Override\n\tprotected void onStart() {\n\t\t\/\/ TODO Auto-generated method stub\n\t\tsuper.onStart();\n\t\tGoogleAnalytics.getInstance(GoogleAnalyticsExample.this).reportActivityStart(this);\n\t}\n\n\n\t@Override\n\tprotected void onStop() {\n\t\t\/\/ TODO Auto-generated method stub\n\t\tsuper.onStop();\n\t\tGoogleAnalytics.getInstance(GoogleAnalyticsExample.this).reportActivityStop(this);\n\t}\n}\n<\/pre>\n<h2>6. Creating the source code of the main GoogleAnalyticsApp Application<\/h2>\n<p>Open <code>src\/com.javacodegeeks.googleanalyticsexample\/GoogleAnalyticsApp.java<\/code> file and paste the code below.<\/p>\n<p><em><span style=\"text-decoration: underline;\">GoogleAnalyticsApp.java<\/span><\/em><\/p>\n<pre class=\"brush:java; wrap-lines:false\">package com.javacodegeeks.googleanalyticsexample;\n\nimport java.util.HashMap;\n\nimport android.app.Application;\n\nimport com.google.android.gms.analytics.GoogleAnalytics;\nimport com.google.android.gms.analytics.Tracker;\n\npublic class GoogleAnalyticsApp extends Application {\n\n\tprivate static final String PROPERTY_ID = \"UA-xxxxxxxx-1\";\n\n\tpublic static int GENERAL_TRACKER = 0;\n\n\tpublic enum TrackerName {\n\t\tAPP_TRACKER, GLOBAL_TRACKER, ECOMMERCE_TRACKER,\n\t}\n\n\tpublic HashMap mTrackers = new HashMap();\n\n\tpublic GoogleAnalyticsApp() {\n\t\tsuper();\n\t}\n\n\tpublic synchronized Tracker getTracker(TrackerName appTracker) {\n\t\tif (!mTrackers.containsKey(appTracker)) {\n\t\t\tGoogleAnalytics analytics = GoogleAnalytics.getInstance(this);\n\t\t\tTracker t = (appTracker == TrackerName.APP_TRACKER) ? analytics.newTracker(PROPERTY_ID) : (appTracker == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker(R.xml.global_tracker) : analytics.newTracker(R.xml.ecommerce_tracker);\n\t\t\tmTrackers.put(appTracker, t);\n\t\t}\n\t\treturn mTrackers.get(appTracker);\n\t}\n}\n<\/pre>\n<h2>7. Creating the source code of the app_tracker.xml<\/h2>\n<p>Open <code>res\/xml\/app_tracker.xml<\/code>, go to the respective xml tab and paste the following:<\/p>\n<p><em><span style=\"text-decoration: underline;\">app_tracker.xml<\/span><\/em><\/p>\n<pre class=\"brush:xml; wrap-lines:false;\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;resources&gt;\n\n    &lt;string name=\"ga_trackingId\"&gt;UA-57749625-1&lt;\/string&gt;\n\n    &lt;bool name=\"ga_autoActivityTracking\"&gt;true&lt;\/bool&gt;\n    &lt;bool name=\"ga_reportUncaughtExceptions\"&gt;true&lt;\/bool&gt;\n\n    &lt;string name=\"ga_appName\"&gt;GoogleAnalyticsApp&lt;\/string&gt;\n    &lt;string name=\"ga_appVersion\"&gt;1.1.3&lt;\/string&gt;\n\n    &lt;bool name=\"ga_debug\"&gt;true&lt;\/bool&gt;\n\n    &lt;item name=\"ga_dispatchPeriod\" format=\"integer\" type=\"integer\"&gt;120&lt;\/item&gt;\n\n    &lt;string name=\"ga_sampleFrequency\"&gt;90&lt;\/string&gt;\n\n    &lt;bool name=\"ga_anonymizeIp\"&gt;true&lt;\/bool&gt;\n    &lt;bool name=\"ga_dryRun\"&gt;false&lt;\/bool&gt;\n\n    &lt;string name=\"ga_sampleFrequency\"&gt;100.0&lt;\/string&gt;\n\n    &lt;integer name=\"ga_sessionTimeout\"&gt;-1&lt;\/integer&gt;\n\n    &lt;string name=\"com.javacodegeeks.googleanalyticsexample\"&gt;GoogleAnalyticsExample&lt;\/string&gt;\n\n&lt;\/resources&gt;\n<\/pre>\n<h2>8. Creating the source code of the ecommerce_tracker.xml<\/h2>\n<p>Open <code>res\/xml\/ecommerce_tracker.xml<\/code>, go to the respective xml tab and paste the following:<\/p>\n<p><em><span style=\"text-decoration: underline;\">ecommerce_tracker.xml<\/span><\/em><\/p>\n<pre class=\"brush:xml; wrap-lines:false;\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;resources&gt;\n    &lt;integer name=\"ga_sessionTimeout\"&gt;60&lt;\/integer&gt;\n    &lt;string name=\"ga_trackingId\"&gt;UA-xxxxxxxx-1&lt;\/string&gt;\n&lt;\/resources&gt;\n<\/pre>\n<h2>9. Creating the source code of the global_tracker.xml<\/h2>\n<p>Open <code>res\/xml\/global_tracker.xml<\/code>, go to the respective xml tab and paste the following:<\/p>\n<p><em><span style=\"text-decoration: underline;\">global_tracker.xml<\/span><\/em><\/p>\n<pre class=\"brush:xml; wrap-lines:false;\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;resources&gt;\n\n    &lt;integer name=\"ga_sessionTimeout\"&gt;300&lt;\/integer&gt;\n\n    &lt;bool name=\"ga_autoActivityTracking\"&gt;true&lt;\/bool&gt;\n\n    &lt;screenName name=\"com.google.android.gms.analytics.samples.mobileplayground.ScreenviewFragment\"&gt;GoogleAnalyticsExample ScreenViewSampleScreen\n&lt;\/screenName&gt;\n    &lt;screenName name=\"com.google.android.gms.analytics.samples.mobileplayground.EcommerceFragment\"&gt;GoogleAnalyticsExample EcommerceSampleScreen\n&lt;\/screenName&gt;\n\n    &lt;string name=\"ga_trackingId\"&gt;UA-xxxxxxxx-1&lt;\/string&gt;\n\n&lt;\/resources&gt;\n<\/pre>\n<h2>9. Android Manifest<\/h2>\n<p>The AndroidManifest.xml of our project is simple and contains the permissions:<\/p>\n<p><em><span style=\"text-decoration: underline;\">AndroidManifest.xml<\/span><\/em><\/p>\n<pre class=\"brush:xml; wrap-lines:false,highlight:[11,12,15]\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;manifest xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    package=\"com.javacodegeeks.googleanalyticsexample\"\n    android:versionCode=\"1\"\n    android:versionName=\"1.0\" &gt;\n\n    &lt;uses-sdk\n        android:minSdkVersion=\"8\"\n        android:targetSdkVersion=\"20\" \/&gt;\n\n    &lt;uses-permission android:name=\"android.permission.INTERNET\" \/&gt;\n    &lt;uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" \/&gt;\n\n    &lt;application\n        android:name=\"com.javacodegeeks.googleanalyticsexample.GoogleAnalyticsApp\"\n        android:allowBackup=\"true\"\n        android:icon=\"@drawable\/ic_launcher\"\n        android:label=\"@string\/app_name\" &gt;\n        &lt;activity\n            android:name=\"com.javacodegeeks.googleanalyticsexample.GoogleAnalyticsExample\"\n            android:label=\"@string\/app_name\" &gt;\n            &lt;intent-filter&gt;\n                &lt;action android:name=\"android.intent.action.MAIN\" \/&gt;\n                &lt;category android:name=\"android.intent.category.LAUNCHER\" \/&gt;\n            &lt;\/intent-filter&gt;\n        &lt;\/activity&gt;\n    &lt;\/application&gt;\n\n    &lt;meta-data\n        android:name=\"com.google.android.gms.version\"\n        android:value=\"@integer\/google_play_services_version\" \/&gt;\n    &lt;meta-data\n        android:name=\"com.google.android.gms.analytics.globalConfigResource\"\n        android:resource=\"@xml\/global_tracker\" \/&gt;\n\n&lt;\/manifest&gt;\n<\/pre>\n<h2>10. Build, compile and run<\/h2>\n<p>When we build, compile and run our project, the main GoogleAnalyticsExample should look like this:<\/p>\n<p><figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-11.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13637\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-11.jpg\" alt=\"Figure 19. This is how the application will look like\" width=\"300\" height=\"533\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 19. This is how the application will look like<\/figcaption><\/figure><\/p>\n<p>Now enter the Google Analytics dashboard by visiting <a href=\"www.google.com\/analytics\/\">www.google.com\/analytics\/<\/a>. You can see the first set of statistics:<\/p>\n<p><figure id=\"attachment_13637\" aria-describedby=\"caption-attachment-13637\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-10.jpg\"><img decoding=\"async\" class=\"size-full wp-image-13637\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample-10.jpg\" alt=\"Figure 20. This is the first set of statistics on Google Analytics Platform\" width=\"800\" height=\"426\" \/><\/a><figcaption id=\"caption-attachment-13637\" class=\"wp-caption-text\">Figure 20. This is the first set of statistics on Google Analytics Platform<\/figcaption><\/figure><\/p>\n<h2>Download the Eclipse Project<\/h2>\n<p>This was an example of Android GoogleAnalyticsExample.<\/p>\n<div class=\"download\"><strong>Download<br \/>\n<\/strong>You can download the full source code of this example here: <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/GoogleAnalyticsExample.zip\"><strong>GoogleAnalyticsExample.<\/strong><\/a><\/div>\n<h2>11. Explore Google Analytics for Android<\/h2>\n<p>Google Analytics for mobile apps provides a platform to measure user interactions, and there are numerous of possibilities you can match. You should visit the <a href=\"https:\/\/developers.google.com\/analytics\/solutions\/mobile-implementation-guide\">Google Analytics guide for Android<\/a> in order to explore how you can implement additional Google Analytics features to better understand your users and their behavior.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Google Analytics is a service offered by Google that generates detailed statistics about a website&#8217;s traffic and traffic sources. It&#8217;s the most widely used website statistics service. However, nowadays, that mobile applications traffic has increased, detailed statistics from mobile platforms are also very important. Google Analytics for mobile applications can measure user behavior in your &hellip;<\/p>\n","protected":false},"author":14,"featured_media":1202,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-17588","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Android Google Analytics v4 Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Google Analytics is a service offered by Google that generates detailed statistics about a website&#039;s traffic and traffic sources. It&#039;s the most widely\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Google Analytics v4 Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Google Analytics is a service offered by Google that generates detailed statistics about a website&#039;s traffic and traffic sources. It&#039;s the most widely\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-18T10:09:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-09T13:06:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Chryssa Aliferi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Chryssa Aliferi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/\"},\"author\":{\"name\":\"Chryssa Aliferi\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/863144453b9fc15d4184d71833dcf332\"},\"headline\":\"Android Google Analytics v4 Example\",\"datePublished\":\"2014-12-18T10:09:12+00:00\",\"dateModified\":\"2023-11-09T13:06:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/\"},\"wordCount\":1172,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"articleSection\":[\"Android\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/\",\"name\":\"Android Google Analytics v4 Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"datePublished\":\"2014-12-18T10:09:12+00:00\",\"dateModified\":\"2023-11-09T13:06:06+00:00\",\"description\":\"Google Analytics is a service offered by Google that generates detailed statistics about a website's traffic and traffic sources. It's the most widely\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Android Google Analytics v4 Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/863144453b9fc15d4184d71833dcf332\",\"name\":\"Chryssa Aliferi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg\",\"caption\":\"Chryssa Aliferi\"},\"description\":\"Chryssa is a Computer Science graduate from Athens University of Economic and Business. During her studies, Chryssa carried out a great variety of projects ranging from networking to software engineering. She is very keen on front end development especially on mobile technologies and web applications. She has worked as a junior Software Engineer in the telecommunications area and currently works as an Android Developer.\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\/\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/chryssa-aliferi\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Google Analytics v4 Example - Java Code Geeks","description":"Google Analytics is a service offered by Google that generates detailed statistics about a website's traffic and traffic sources. It's the most widely","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/","og_locale":"en_US","og_type":"article","og_title":"Android Google Analytics v4 Example - Java Code Geeks","og_description":"Google Analytics is a service offered by Google that generates detailed statistics about a website's traffic and traffic sources. It's the most widely","og_url":"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2014-12-18T10:09:12+00:00","article_modified_time":"2023-11-09T13:06:06+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","type":"image\/jpeg"}],"author":"Chryssa Aliferi","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Chryssa Aliferi","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/"},"author":{"name":"Chryssa Aliferi","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/863144453b9fc15d4184d71833dcf332"},"headline":"Android Google Analytics v4 Example","datePublished":"2014-12-18T10:09:12+00:00","dateModified":"2023-11-09T13:06:06+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/"},"wordCount":1172,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","articleSection":["Android"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/","url":"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/","name":"Android Google Analytics v4 Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","datePublished":"2014-12-18T10:09:12+00:00","dateModified":"2023-11-09T13:06:06+00:00","description":"Google Analytics is a service offered by Google that generates detailed statistics about a website's traffic and traffic sources. It's the most widely","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/android\/android-google-analytics-v4-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Android","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/"},{"@type":"ListItem","position":3,"name":"Android Google Analytics v4 Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/863144453b9fc15d4184d71833dcf332","name":"Chryssa Aliferi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg","caption":"Chryssa Aliferi"},"description":"Chryssa is a Computer Science graduate from Athens University of Economic and Business. During her studies, Chryssa carried out a great variety of projects ranging from networking to software engineering. She is very keen on front end development especially on mobile technologies and web applications. She has worked as a junior Software Engineer in the telecommunications area and currently works as an Android Developer.","sameAs":["http:\/\/www.javacodegeeks.com\/"],"url":"https:\/\/examples.javacodegeeks.com\/author\/chryssa-aliferi\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/17588","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=17588"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/17588\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1202"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=17588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=17588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=17588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}