{"id":47161,"url":"https://github.com/basvdijk/capacitor4-firebase-analytics-example-project-capawesome-team","name":"capacitor4-firebase-analytics-example-project-capawesome-team","description":"Capacitor4 with Firebase Analytics example project","projects_count":36,"last_synced_at":"2026-08-22T13:00:21.766Z","repository":{"id":60256868,"uuid":"540342225","full_name":"basvdijk/capacitor4-firebase-analytics-example-project-capawesome-team","owner":"basvdijk","description":"Capacitor4 with Firebase Analytics example project","archived":false,"fork":false,"pushed_at":"2023-10-12T14:06:00.000Z","size":640,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-08-03T01:04:06.445Z","etag":null,"topics":["capacitor","firebase","firebaseanalytics","ionic","vue"],"latest_commit_sha":null,"homepage":"","language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/basvdijk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-09-23T08:13:11.000Z","updated_at":"2024-05-03T23:36:06.000Z","dependencies_parsed_at":"2024-01-17T02:28:59.301Z","dependency_job_id":null,"html_url":"https://github.com/basvdijk/capacitor4-firebase-analytics-example-project-capawesome-team","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/basvdijk/capacitor4-firebase-analytics-example-project-capawesome-team","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basvdijk%2Fcapacitor4-firebase-analytics-example-project-capawesome-team","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basvdijk%2Fcapacitor4-firebase-analytics-example-project-capawesome-team/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basvdijk%2Fcapacitor4-firebase-analytics-example-project-capawesome-team/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basvdijk%2Fcapacitor4-firebase-analytics-example-project-capawesome-team/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/basvdijk","download_url":"https://codeload.github.com/basvdijk/capacitor4-firebase-analytics-example-project-capawesome-team/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basvdijk%2Fcapacitor4-firebase-analytics-example-project-capawesome-team/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36823485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-08-06T04:43:03.162Z","status":"online","status_checked_at":"2026-08-22T02:00:06.114Z","response_time":51,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"created_at":"2024-01-14T11:15:07.522Z","updated_at":"2026-08-22T13:00:21.767Z","primary_language":null,"list_of_lists":false,"displayable":true,"categories":["Add GoogleService-Info.plist","Add google-services.json","Add FirebaseAnalytics to podfile","Installing Pods","Enable debugging","Package name","Run the project","Add Android Firebase SDK","Setting the correct JDK","Run on Android device","Enable Firebase Analytics debugging"],"sub_categories":[],"readme":"This is an example project in order to test the [@capacitor-firebase/analytics](https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/analytics) made by [capawesome-team](https://github.com/capawesome-team)\n\nFor me as a web developer it was quite some work to setup the native SDKs. Therefore I've made an Ionic VUE project to test the Capacitor Firebase Analytics plugin.\n\nBelow you'll find how to setup the SDK for Android and iOS after you've configured your project in Firebase.\n\n# Ionic App\nThis repo contains an example Ionic VUE project with the Capacitor Firebase Analytics plugin. It was generated using the side-menu boilerplate.\n\nI've added the `@capacitor-firebase/analytics` and `fireabase` package\n```\nnpm install @capacitor-firebase/analytics firebase\nnpx cap sync\n```\n\nIn `main.ts` I've added some code to initialise Firebase Analytics:\n\n```typescript\nconst setEnabled = async () =\u003e {\n  await FirebaseAnalytics.setEnabled({\n    enabled: true,\n  });\n};\n\nconst setCurrentScreen = async () =\u003e {\n  await FirebaseAnalytics.setCurrentScreen({\n    screenName: \"Login\",\n    screenClassOverride: \"LoginPage\",\n  });\n};\n\nconst initAnalytics = async () =\u003e {\n  await setEnabled();\n  await setCurrentScreen();\n};\n\ninitAnalytics();\n```\n\nIn `router/index.ts` I've added code to capture the view changes and send these as screen_view to Analytics\n\n```typescript\nrouter.beforeEach(async (to, from, next) =\u003e {\n  await FirebaseAnalytics.setCurrentScreen({\n    screenName: to.path as string,\n    screenClassOverride: to.path as string,\n  });\n\n  return next();\n});\n```\n\n\n# Setting up Firebase Analytics SDK for iOS - XCode Version 13.4.1 (13F100)\n\n⚠️ DO NOT ADD THE FIREBASE SDK TO YOUR PROJECT VIA XCODE!!!\n\n## Add FirebaseAnalytics to podfile\n\nOpen `ios/App/Podfile` in your favorite editor\n\n![image](https://user-images.githubusercontent.com/644550/191931847-bab4f752-4200-4aa4-8f50-a85a342c0e62.png)\n\nAdd the line \n\n`pod 'CapacitorFirebaseAnalytics/AnalyticsWithoutAdIdSupport', :path =\u003e '../../node_modules/@capacitor-firebase/analytics'`\n\nor \n\n`pod 'CapacitorFirebaseAnalytics/Analytics', :path =\u003e '../../node_modules/@capacitor-firebase/analytics'`\n\nIf you want to have the IDFA collection capability enabled\n\n## Installing Pods\n\nIn your terminal navigate to the `ios/App` folder (the one with the podfile you've edit)\n\nRun `pod install` You should see something like:\n\n![image](https://user-images.githubusercontent.com/644550/191930930-f7be56bf-783d-4389-969a-8a2f3b2b3e1d.png)\n\n\n## Add GoogleService-Info.plist\n\nThis section assumes that you have already [set up a Firebase project](https://firebase.google.com/docs/ios/setup) or [a Google Analytics iOS stream](https://support.google.com/analytics/answer/9304153#stream).\n \nDownload `GoogleService-Info.plist` from Firebase or Google Analytics console.\n\n* **Firebase**: see [Firebase Help](https://support.google.com/firebase/answer/7015592#ios) for instructions.\n* **Google Analytics**: go to [Google Analytics console](https://analytics.google.com/analytics/), then navigate to \"⚙ Admin (sidebar)\" -\u003e \"Data streams\" -\u003e Your iOS App -\u003e \"Download GoogleService-Info.plist\".\n\nOpen XCode by running `npx cap open ios` from the root of your project\n\nRight click on the `App` folder and choose `Add files to \"App\"`. I've read that dragging the file in could cause issues.\n\n![image](https://user-images.githubusercontent.com/644550/191928818-c215cfe9-f854-4fa4-8c0b-2b01bee90bf1.png)\n\nIn the file picker navigate to your `GoogleService-Info.plist` and add it\n\nIt should now appear in the file tree\n\n![image](https://user-images.githubusercontent.com/644550/191929040-928c19c0-ac5a-45fd-8d4e-68d82dec0068.png)\n\n## Enable debugging\n\nFrom the menu open Product -\u003e Scheme -\u003e Edit scheme\n\nClick the + button and add `-FIRDebugEnabled` (more info at https://firebase.google.com/docs/analytics/debugview)\n\n![image](https://user-images.githubusercontent.com/644550/191932437-13dcb75e-4c91-4e94-9d3c-030de2851279.png)\n\nClick \"close\"\n\n## Package name\n\nSelect \"App\" under the Products folder in the tree. Make sure you have the correct package name set\n\nAlso set the correc team in the \"Signing \u0026 Capabilities\" tab\n\n![image](https://user-images.githubusercontent.com/644550/191930426-0cff83ef-3d45-427e-afee-0c52c7472707.png)\n\n## Run the project\n\n![image](https://user-images.githubusercontent.com/644550/191932894-771c67fb-f62d-4c6f-93eb-bbde59698f93.png)\n\nRun the project\n\nChange screens via the hamburger menu on your iOS device. The output should show:\n\n![image](https://user-images.githubusercontent.com/644550/191932835-954b7381-673c-4b2f-93ec-115e318e9ba1.png)\n\nYour Firebase Analytics should see the events:\n\n![image](https://user-images.githubusercontent.com/644550/191932852-b956932a-8dc6-4a3d-9a10-6951d27cc654.png)\n\n⚠️ Make sure to disable debugging before releasing your project\n\n\n\n\n\n\n\n\n\n# Setting up Firebase Analytics SDK for Android - Android Studio Dolphin | 2021.3.1\n\n## Add google-services.json\n\nThis section assumes that you have already [set up a Firebase project](https://firebase.google.com/docs/android/setup) or [a Google Analytics Android stream](https://support.google.com/analytics/answer/9304153#stream).\n \nDownload `google-services.json` from Firebase or Google Analytics console.\n\n* **Firebase**: see [Firebase Help](https://support.google.com/firebase/answer/7015592#android) for instructions.\n* **Google Analytics**: go to [Google Analytics console](https://analytics.google.com/analytics/), then navigate to \"⚙ Admin (sidebar)\" -\u003e \"Data streams\" -\u003e Your Android App -\u003e \"Download google-services.json\".\n\nOpen Android Studio with `npx cap open android`\n\n![image](https://user-images.githubusercontent.com/644550/191918886-5e1b46b8-44d2-41e2-88e6-e2d006e85b38.png)\n\nAndroid Studio probably opens in the \"Android\" view instead of the project view like the \"Add Firebase to your Android app\" instruction shows\n\n![image](https://user-images.githubusercontent.com/644550/191919036-40b0b2f4-2140-4d04-94b0-0b974b25b45d.png)\n\nSwitch to the project view via the dropdown\n\n![image](https://user-images.githubusercontent.com/644550/191919235-0c8a5781-3c43-4b5b-88fb-e8dfe5af394b.png)\n\nThe second android folder shows the structure as shown in the Firebase instructions\n\n![image](https://user-images.githubusercontent.com/644550/191919451-38f35880-4871-48c2-901d-2b7c66c5b974.png)\n\nDrag the `google-services.json` file into the app folder. You'll get a prompt\n\n![image](https://user-images.githubusercontent.com/644550/191919991-1b2069de-29bd-43d7-988d-f191782c55b1.png)\n\nChoose `refactor`\n\n## Add Android Firebase SDK\n\nOpen the `build.gradle` at the root of the project\n\n![image](https://user-images.githubusercontent.com/644550/191920216-ef538fb8-f4d1-4b14-88ea-f2a8b8667e99.png)\n\nThe Google instruction says:\n\n\u003e // Add the dependency for the Google services Gradle plugin\n\u003e `classpath 'com.google.gms:google-services:4.3.13'`\n\nHowever in my `build.gradle` it was already added\n\nOpen the `build.gradle` in your project\n\n![image](https://user-images.githubusercontent.com/644550/191920929-f4064e9a-7998-4e23-9f68-a7ba6cdeac6a.png)\n\nAdd this code to the `dependencies` section\n\n```\n  // Import the Firebase BoM\n  implementation platform('com.google.firebase:firebase-bom:30.4.1')\n\n  // TODO: Add the dependencies for Firebase products you want to use\n  // When using the BoM, don't specify versions in Firebase dependencies\n  implementation 'com.google.firebase:firebase-analytics'\n\n\n  // Add the dependencies for any other desired Firebase products\n  // https://firebase.google.com/docs/android/setup#available-libraries\n```\n\n\n![image](https://user-images.githubusercontent.com/644550/191921135-ee27948b-4ff8-4c2c-9f27-6b26284804b6.png)\n\nSync Gradle manually\n\n![image](https://user-images.githubusercontent.com/644550/191921398-2a2dd65d-12f9-46b8-85f4-44f43e2d1499.png)\n\nYou should see:\n\n![image](https://user-images.githubusercontent.com/644550/191921431-16a7d4a3-b714-4f6f-9822-ddc82e289074.png)\n\nThen `make the project`\n\n![image](https://user-images.githubusercontent.com/644550/191921653-0567df0b-78b4-4cf1-bed7-f2f99dd551cc.png)\n\n## Setting the correct JDK\n\nI got this error:\n\n```\nA problem occurred evaluating project ':app'.\n\u003e Failed to apply plugin 'com.android.internal.application'.\n   \u003e Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.\n     Your current JDK is located in  /Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home/jre\n     You can try some of the following options:\n       - changing the IDE settings.\n       - changing the JAVA_HOME environment variable.\n       - changing `org.gradle.java.home` in `gradle.properties`.\n```\n\nGoto file -\u003e Project structure\n\n![image](https://user-images.githubusercontent.com/644550/191921871-9c5fdfac-4465-4738-bc73-c65bed2f4f6b.png)\n\nSDK location -\u003e Gradle Settings\n\n![image](https://user-images.githubusercontent.com/644550/191921942-1d54f24a-ae46-4682-99f3-21a95085909d.png)\n\nI chose \"embedded JDK\"\n\n![image](https://user-images.githubusercontent.com/644550/191922000-345938a9-e102-4a80-a198-d359ba06066b.png)\n\nClick \"OK\" twice to close the Gradle Settings and Project Strucure dialogs\n\nThen `make the project` again\n\n![image](https://user-images.githubusercontent.com/644550/191921653-0567df0b-78b4-4cf1-bed7-f2f99dd551cc.png)\n\nIf everything ran fine you should see\n\n![image](https://user-images.githubusercontent.com/644550/191923181-55117d1d-87db-4272-b20b-61ba5f33eb23.png)\n\n## Run on Android device\n\nConnect your Android device via USB if you don't have already\n\nYou should see your device in the dropdown:\n\n![image](https://user-images.githubusercontent.com/644550/191923464-0b9dcc13-5e2a-4f9d-bec4-810d1b7c3119.png)\n\nNow run the app via the green arrow icon or menu\n\n![image](https://user-images.githubusercontent.com/644550/191923561-60103611-2483-4add-8bd6-a4dfcca83d96.png)\n\nOn your Android device, in the app navigate to screens via the hamburger menu.\n\nYou should now see the event showing up in Firebase Analytics\n\n![image](https://user-images.githubusercontent.com/644550/191923801-e0c4ff9b-2251-4701-b391-eecce12d5b9f.png)\n\n\n\n## Enable Firebase Analytics debugging\n\nOn the command line run (replace com.usto.cap4test) with your own:\n\n```bash\nadb shell setprop debug.firebase.analytics.app com.usto.cap4test\n```\n\nOpen the \"Logcat\" tab at the bottom of your IDE and select in the dropdown on the top right \"Firebase\" to see the debug events:\n\n![image](https://user-images.githubusercontent.com/644550/191925020-aa700433-86d7-44f3-9489-b3a920f7d5ee.png)\n\nOr if you have the new Logcat view you can just open Logcat to see the debug events\n\n![image](https://user-images.githubusercontent.com/644550/191925325-cfe47a77-7a48-4b2d-8f44-72cdfeae0a8f.png)\n\n⚠️ Make sure to disable debugging before releasing your project with\n\n`adb shell setprop debug.firebase.analytics.app .none.`\n\n\n\n\n\n\n\n\n","projects_url":"https://awesome.ecosyste.ms/api/v1/lists/basvdijk%2Fcapacitor4-firebase-analytics-example-project-capawesome-team/projects"}