{"id":96320,"date":"2025-02-18T23:20:34","date_gmt":"2025-02-18T23:20:34","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/ios-quickstart-with-google-analytics-for-firebase-and-google-tag-manager\/"},"modified":"2025-02-18T23:20:34","modified_gmt":"2025-02-18T23:20:34","slug":"ios-quickstart-with-google-analytics-for-firebase-and-google-tag-manager","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=96320","title":{"rendered":"iOS Quickstart With Google Analytics For Firebase And Google Tag Manager"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p>A while ago, I <a href=\"https:\/\/www.simoahava.com\/analytics\/android-quickstart-google-analytics-firebase-google-tag-manager\/\">published<\/a> an article on how to build an Android application, and bundle it with <a href=\"https:\/\/console.firebase.google.com\/\">Firebase<\/a>. The purpose of that article, and the one you are reading now, is to slowly introduce the world of mobile app development and Firebase, given the latter is getting more and more traction as Google\u2019s go-to <a href=\"https:\/\/www.blog.google\/products\/marketingplatform\/analytics\/new-way-unify-app-and-website-measurement-google-analytics\/\">analytics platform<\/a>.<\/p>\n<p>After finishing work on the Android guide, I immediately started working on its counterpart for iOS, and that\u2019s the one you\u2019re reading now.<\/p>\n<div style=\"aspect-ratio: 1371 \/ 463;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-process.jpg\" title=\"iOS Process\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"463\" width=\"1371\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-process.jpg#ZgotmplZ\" alt=\"iOS Process\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>The process is essentially the same. We\u2019ll develop the application using Mac\u2019s own integrated development environment (<a href=\"https:\/\/developer.apple.com\/xcode\/\">Xcode<\/a>), and the steps to create and integrate <a href=\"https:\/\/firebase.google.com\/docs\/analytics\/ios\/start\">Firebase<\/a> and <a href=\"https:\/\/developers.google.com\/tag-manager\/ios\/v5\/\">Google Tag Manager<\/a> deviate only very little from Android.<\/p>\n<p>I\u2019ve also created <a href=\"https:\/\/www.youtube.com\/watch?v=yaXVnvEzzTc\">a video<\/a> you can watch if you prefer.<\/p>\n<p>\n  <iframe src=\"https:\/\/www.youtube-nocookie.com\/embed\/yaXVnvEzzTc?enablejsapi=1\" style=\"position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;\" allowfullscreen=\"\" title=\"YouTube Video\"><\/iframe>\n<\/p>\n<p>                <span class=\"simmer\"><br \/>\n  <span class=\"close\">X<\/span><\/p>\n<p>\n    <span class=\"fa fa-md fa-bell\"\/><br \/>\n    <strong>The Simmer Newsletter<\/strong>\n  <\/p>\n<p>\n    Subscribe to the <a href=\"https:\/\/www.simoahava.com\/newsletter\/\">Simmer newsletter<\/a> to get the latest news and content from Simo Ahava into your email inbox!\n  <\/p>\n<p>  <\/span><\/p>\n<h2 id=\"what-youll-build\">What you\u2019ll build<\/h2>\n<p>We\u2019ll build an <strong>iOS<\/strong> application using the <a href=\"https:\/\/developer.apple.com\/swift\/\">Swift<\/a> programming language. The application will be built with <strong>Xcode<\/strong>, so you\u2019ll need to use a <strong>Mac<\/strong> computer for this as there\u2019s no native support for Xcode on other platforms.<\/p>\n<p>Next, we\u2019ll create a <strong>Firebase<\/strong> project, and connect it to a <strong>Google Analytics<\/strong> account. After doing this, your application will <a href=\"https:\/\/support.google.com\/firebase\/answer\/6317485?hl=en\">automatically collect some events<\/a>.<\/p>\n<p>We\u2019ll add a simple <code>select_content<\/code> event, which will be logged in Google Analytics for Firebase.<\/p>\n<p>Finally, we\u2019ll create a <strong>Google Tag Manager<\/strong> container, and have it listen for the <code>select_content<\/code> event, and then duplicate its content to a <strong>Universal Analytics<\/strong> endpoint.<\/p>\n<p>The application we\u2019ll create will be hideous and feature-bare. Creating a flashy app is not the point here. I want to show you how easy it is to get started, and you can use even this simplest of applications to play around with Firebase in order to learn how it works.<\/p>\n<h2 id=\"step-1-create-a-project-in-xcode\">Step 1: Create a project in Xcode<\/h2>\n<p>Let\u2019s get started!<\/p>\n<p>Go to the <strong>Applications<\/strong> folder of your Mac and launch Xcode.<\/p>\n<div style=\"aspect-ratio: 763 \/ 528;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/launch-xcode.jpg\" title=\"Launch xcode\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"528\" width=\"763\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/launch-xcode.jpg#ZgotmplZ\" alt=\"Launch xcode\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Click on <strong>File<\/strong> -&gt; <strong>New<\/strong> -&gt; <strong>Project<\/strong> to create a new Xcode project.<\/p>\n<p>Choose the <strong>Single View App<\/strong> as the template, and click <strong>Next<\/strong>.<\/p>\n<div style=\"aspect-ratio: 732 \/ 526;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-choose-template.jpg\" title=\"Choose iOS template\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"526\" width=\"732\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-choose-template.jpg#ZgotmplZ\" alt=\"Choose iOS template\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>In the next screen, give the product a name such as <code>My Test Application<\/code>. If you want to run the application on a <strong>physical device<\/strong>, choose yourself from the <strong>Team<\/strong> drop-down. If the Team dropdown doesn\u2019t show your name (as configured on your Apple ID), follow the options to create a personal team with your Apple ID.<\/p>\n<blockquote>\n<p><strong>Note!<\/strong> You only have to do this if you want to run the application on your physical device. We\u2019ll be using a simulator in the examples so you can ignore the Team drop-down as well.<\/p>\n<\/blockquote>\n<p>You can give a custom <strong>Organization Identifier<\/strong>, as that makes it easier to remember your bundle identifier (which you\u2019ll need when creating the Firebase project).<\/p>\n<p>Make sure <strong>Swift<\/strong> is selected as the language, and when ready click <strong>Next<\/strong>.<\/p>\n<div style=\"aspect-ratio: 726 \/ 524;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-project-options.jpg\" title=\"iOS project options\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"524\" width=\"726\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-project-options.jpg#ZgotmplZ\" alt=\"iOS project options\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Finally, navigate to the directory where you want to create the project in. In my example, it\u2019s a directory named <code>ios-test<\/code>.<\/p>\n<p>Click <strong>Create<\/strong> when done.<\/p>\n<div style=\"aspect-ratio: 798 \/ 446;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-choose-directory.jpg\" title=\"iOS choose directory\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"446\" width=\"798\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-choose-directory.jpg#ZgotmplZ\" alt=\"iOS choose directory\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Xcode will now proceed to create your project. Once done, it will open the project\u2019s general settings and show you the project structure in the left.<\/p>\n<div style=\"aspect-ratio: 1396 \/ 332;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-project-view.jpg\" title=\"iOS project view\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"332\" width=\"1396\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-project-view.jpg#ZgotmplZ\" alt=\"iOS project view\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Before we run our app for the first time, let\u2019s add some heart to it. Click <strong>Main.storyboard<\/strong> to open the visual editor for the application\u2019s user interface.<\/p>\n<p>Click the <strong>Object Library<\/strong> icon in the top bar of Xcode, and type <code>text<\/code> in the search bar that appears. Drag-and-drop the <strong>Text Field<\/strong> item into the middle of the view.<\/p>\n<div style=\"aspect-ratio: 868 \/ 381;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/main-storyboard.jpg\" title=\"Main storyboard\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"381\" width=\"868\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/main-storyboard.jpg#ZgotmplZ\" alt=\"Main storyboard\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Double-click the Text Field in the view, and type in <code>Hello World!<\/code>. You can reposition the field if you wish &#8211; though it won\u2019t make it any prettier. This is what it should look like:<\/p>\n<div style=\"aspect-ratio: 1010 \/ 525;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-hello-world.jpg\" title=\"ios-hello-world\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"525\" width=\"1010\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-hello-world.jpg#ZgotmplZ\" alt=\"ios-hello-world\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Now that we\u2019ve created a <em>beautiful user interface<\/em>, we can run the application. Choose a phone model, e.g. <strong>iPhone 6<\/strong> from the device menu, and click the <strong>Play<\/strong> button to build the application and run the simulator.<\/p>\n<div style=\"aspect-ratio: 463 \/ 231;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-run-app-first-time.jpg\" title=\"Run iOS app for the first time\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"231\" width=\"463\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-run-app-first-time.jpg#ZgotmplZ\" alt=\"Run iOS app for the first time\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>It\u2019s going to take a while for the application to start, but once it does, you\u2019ll be able to see it in the emulator window (it\u2019s a different application that starts so remember to switch to it).<\/p>\n<div style=\"aspect-ratio: 933 \/ 656;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/emulator-view.jpg\" title=\"Emulator view\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"656\" width=\"933\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/emulator-view.jpg#ZgotmplZ\" alt=\"Emulator view\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Congratulations! You\u2019ve built the iOS application we\u2019ll use as the testbed in this article. In the next step, we\u2019ll configure <strong>Firebase<\/strong>!<\/p>\n<h2 id=\"step-2-create-a-firebase-project\">Step 2: Create a Firebase project<\/h2>\n<p>Here, I\u2019ll recommend you follow the <strong>exact same steps<\/strong> as in the Android article. Open <a href=\"https:\/\/www.simoahava.com\/analytics\/android-quickstart-google-analytics-firebase-google-tag-manager\/#step-2-create-a-firebase-project\">this link<\/a> in a new browser tab to learn how to create the Firebase project. Once the project is created, switch back to this article.<\/p>\n<h2 id=\"step-3-deploy-firebase-sdk-in-application\">Step 3: Deploy Firebase SDK in application<\/h2>\n<p>Once you have the project created, you\u2019ll need to integrate it into your <strong>iOS application<\/strong>.<\/p>\n<p>Click the <strong>iOS<\/strong> icon in the middle of the Project Overview dashboard.<\/p>\n<div style=\"aspect-ratio: 678 \/ 316;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-add-firebase-app.jpg\" title=\"Add to iOS app\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"316\" width=\"678\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-add-firebase-app.jpg#ZgotmplZ\" alt=\"Add to iOS app\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>In the <strong>iOS bundle ID<\/strong> field, copy-paste the Bundle identifier you can find in Xcode by first selecting your project, and then looking in the <strong>Identity<\/strong> section of the <strong>General<\/strong> tab of your project settings.<\/p>\n<div style=\"aspect-ratio: 784 \/ 283;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-bundle-identifier.jpg\" title=\"iOS Bundle identifier\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"283\" width=\"784\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-bundle-identifier.jpg#ZgotmplZ\" alt=\"iOS Bundle identifier\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Give the app a nickname such as <code>My iOS App<\/code> if you wish, and then click <strong>Register app<\/strong>.<\/p>\n<div style=\"aspect-ratio: 544 \/ 425;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-register-app.jpg\" title=\"iOS register app\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"425\" width=\"544\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-register-app.jpg#ZgotmplZ\" alt=\"iOS register app\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>In the next screen, download the <strong>GoogleService-Info.plist<\/strong> file, and then drag-and-drop it to the project directory in Xcode (the yellow folder). You should see a screen like this, so make sure to check all the options as in the example.<\/p>\n<div style=\"aspect-ratio: 729 \/ 426;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-googleservice-info.jpg\" title=\"iOS googleservice-info.plist\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"426\" width=\"729\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-googleservice-info.jpg#ZgotmplZ\" alt=\"iOS googleservice-info.plist\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>You should end up with the file within the project directory.<\/p>\n<div style=\"aspect-ratio: 642 \/ 220;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-plist-file.jpg\" title=\"GoogleService file in the correct place\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"220\" width=\"642\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-plist-file.jpg#ZgotmplZ\" alt=\"GoogleService file in the correct place\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>In the web browser, click <strong>Next<\/strong> when done.<\/p>\n<p>Now you need to add the <strong>Firebase SDK<\/strong> to your project. To do that, you need to initialize a <strong>Podfile<\/strong> to manage your application\u2019s dependencies.<\/p>\n<p>Open the <strong>Terminal<\/strong> application, and browse to your project root, i.e. the directory which has the <code>My Project Name.xcodeproj<\/code> file. In this directory, type this and hit enter:<\/p>\n<div class=\"highlight\">\n<pre style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-text\" data-lang=\"text\">sudo gem install cocoapods<\/code><\/pre>\n<\/div>\n<p>It\u2019s a super-user command, so you\u2019ll need to input your admin password. This installs the latest version of <strong>Cocoapods<\/strong>, the dependency manager for iOS.<\/p>\n<p>Once done, type this and hit enter:<\/p>\n<p>If you now list the contents of the directory with <code>ls<\/code>, you should see a new <code>Podfile<\/code> listed among the files and folders.<\/p>\n<div style=\"aspect-ratio: 567 \/ 259;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/console-screenshot.jpg\" title=\"Console screenshot\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"259\" width=\"567\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/console-screenshot.jpg#ZgotmplZ\" alt=\"Console screenshot\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Open the Podfile in a <strong>plain text editor<\/strong>. You can open it in Mac\u2019s <strong>TextEdit<\/strong> by typing <code>open Podfile<\/code> in the console while in the directory with the Podfile.<\/p>\n<p>Under the <code># Pods for <my project=\"\"\/><\/code>, add the following two lines:<\/p>\n<div class=\"highlight\">\n<pre style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-text\" data-lang=\"text\">pod 'Firebase\/Analytics'\npod 'GoogleTagManager'<\/code><\/pre>\n<\/div>\n<p>This is what it should look like:<\/p>\n<div style=\"aspect-ratio: 1124 \/ 476;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/podfile.jpg\" title=\"Podfile\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"476\" width=\"1124\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/podfile.jpg#ZgotmplZ\" alt=\"Podfile\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Once done, save the file and close it.<\/p>\n<p>Now, in the <strong>Terminal<\/strong>, while in the same directory as the <strong>Podfile<\/strong>, type the following command and press Enter.<\/p>\n<p>You should see a bunch of dependencies being installed, including <strong>Firebase<\/strong> and <strong>Google Analytics \/ Tag Manager<\/strong> modules.<\/p>\n<div style=\"aspect-ratio: 1298 \/ 786;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/pod-install.jpg\" title=\"pod install\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"786\" width=\"1298\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/pod-install.jpg#ZgotmplZ\" alt=\"pod install\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>You should now see a new file in this directory, named <code>Your Project.xcworkspace<\/code>. From now on, you\u2019ll need to use this instead of the <code>Your Project.xcodeproj<\/code> file when working on the project in Xcode. The workspace bundles the <strong>Pods<\/strong> you downloaded together with your project, and lets you build an application that includes all the modules you have indicated as dependencies.<\/p>\n<p>So go ahead and <strong>close Xcode<\/strong> and the <strong>iOS simulator<\/strong>, and then re-open Xcode by opening the <code>Your Project.xcworkspace<\/code> file.<\/p>\n<p>If everything works as it should, you\u2019ll now see both your project root and the <strong>Pods<\/strong> group in the project navigator.<\/p>\n<div style=\"aspect-ratio: 1224 \/ 890;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/xcode-workspace.jpg\" title=\"Xcode workspace\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"890\" width=\"1224\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/xcode-workspace.jpg#ZgotmplZ\" alt=\"Xcode workspace\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Now, go back to the web browser with your Firebase SDK setup. As you\u2019ve now added the SDK as a dependency, click the <strong>Next<\/strong> button.<\/p>\n<div style=\"aspect-ratio: 1508 \/ 1176;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/firebase-sdk-added.jpg\" title=\"Firebase SDK added\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"1176\" width=\"1508\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/firebase-sdk-added.jpg#ZgotmplZ\" alt=\"Firebase SDK added\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>The next step is to initialize the SDK in your application. Open Xcode, and then click the <strong>AppDelegate.swift<\/strong> class file to open it for editing.<\/p>\n<p>Here, right after the <code>import UIKit<\/code> statement, add the following line:<\/p>\n<p>This imports the <code>Firebase<\/code> set of modules. To initialize the Firebase SDK, add the following line of code into the <code>application<\/code> method, just before the <code>return true<\/code> statement:<\/p>\n<p>This is what your <strong>AppDelegate.swift<\/strong> should look like after the changes.<\/p>\n<div style=\"aspect-ratio: 1496 \/ 588;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/appdelegate-swift.jpg\" title=\"AppDelegate.swift\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"588\" width=\"1496\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/appdelegate-swift.jpg#ZgotmplZ\" alt=\"AppDelegate.swift\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Next thing to do is to save your changes and <strong>run<\/strong> the application in a simulator. So pick a phone model from the drop-down and then click the <strong>Play<\/strong> button again.<\/p>\n<p>The application itself won\u2019t show anything has changed, but you might see some new, Firebase-related items in the Xcode logs.<\/p>\n<div style=\"aspect-ratio: 1666 \/ 1132;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/firebase-in-logs.jpg\" title=\"Firebase in logs\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"1132\" width=\"1666\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/firebase-in-logs.jpg#ZgotmplZ\" alt=\"Firebase in logs\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<blockquote>\n<p><strong>Note!<\/strong> You can also filter for <code>GoogleTagManager<\/code> to see evidence that the GTM dependency has loaded. However, since you don\u2019t (yet) have a container added to the project, the only log will be a simple entry telling you that no container was found.<\/p>\n<\/blockquote>\n<p>Once you\u2019ve run the app and verified that Firebase is initialized, go back to the web browser to finish the SDK setup.<\/p>\n<p>From the <strong>Add initialization code<\/strong> step, click <strong>Next<\/strong> to proceed to verification.<\/p>\n<p>Now, if you\u2019ve run your app in Xcode on a computer with internet access, this final step should shortly show a green checkmark to confirm you\u2019ve initialized the Firebase SDK.<\/p>\n<div style=\"aspect-ratio: 1492 \/ 1150;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-verify-firebase.jpg\" title=\"iOS verify Firebase\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"1150\" width=\"1492\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-verify-firebase.jpg#ZgotmplZ\" alt=\"iOS verify Firebase\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Nice work! Click <strong>Continue to console<\/strong> to finish the setup.<\/p>\n<p>You now have a working Firebase installation running in your app. You can now actually visit <a href=\"https:\/\/analytics.google.com\/\">Google Analytics<\/a>, browser to your Firebase <strong>App + Web<\/strong> property for this project, and see your data in the <strong>StreamView<\/strong> report within.<\/p>\n<div style=\"aspect-ratio: 1448 \/ 298;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-analytics-sneak.jpg\" title=\"iOS analytics sneak\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"298\" width=\"1448\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-analytics-sneak.jpg#ZgotmplZ\" alt=\"iOS analytics sneak\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>However, let\u2019s not get ahead of ourselves. In the next chapter we\u2019ll add some Firebase event logging to the application!<\/p>\n<h2 id=\"step-4-add-basic-analytics-to-the-application\">Step 4: Add basic analytics to the application<\/h2>\n<p>Now, let\u2019s add a simple Firebase event to our application.<\/p>\n<p>Open the <strong>ViewController.swift<\/strong> class. This class controls the view (d\u2019oh) where you added the \u201cHello World!\u201d text to.<\/p>\n<p>In this class, load the relevant Firebase dependency with the following import command added to the beginning of the file:<\/p>\n<p>Next, at the end of the <code>viewDidLoad()<\/code> function, add the following lines of code:<\/p>\n<div class=\"highlight\">\n<pre style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-swift\" data-lang=\"swift\">Analytics.logEvent(AnalyticsEventSelectContent, parameters: [\n    AnalyticsParameterItemID: <span style=\"color:#a50\">\"my_item_id\"<\/span>\n])<\/code><\/pre>\n<\/div>\n<p>When you want to send events to Firebase Analytics, you use the <code>Analytics<\/code> singleton and its <code>logEvent()<\/code> method.<\/p>\n<p>This method takes two arguments: the <strong>event name<\/strong> and a list of key-value pairs in a <code>parameters<\/code> list.<\/p>\n<p>For the event name, you can provide a custom name such as <code>\"my_custom_event\"<\/code>, or you can utilize the standard events suggested by Firebase by accessing them through the <code>AnalyticsEvent.*<\/code> enumerated namespace.<\/p>\n<p>For the key-value pairs in <code>parameters<\/code>, you can again use a custom key name such as <code>\"my_custom_key\"<\/code>, or you can use the suggested parameter names by accessing them through the <code>AnalyticsParameter.*<\/code> enum.<\/p>\n<p>We are using the <code>AnalyticsEventSelectContent<\/code> enum, which returns <code>select_content<\/code> at runtime, and we are using the <code>AnalyticsParameterItemID<\/code> key, which returns <code>item_id<\/code> at runtime.<\/p>\n<p>Here\u2019s what the modified <strong>ViewController.swift<\/strong> should look like:<\/p>\n<div style=\"aspect-ratio: 1148 \/ 514;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-viewcontroller-changed.jpg\" title=\"Viewcontroller changed\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"514\" width=\"1148\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-viewcontroller-changed.jpg#ZgotmplZ\" alt=\"Viewcontroller changed\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<h2 id=\"step-5-debug-and-verify-everything-works\">Step 5: Debug and verify everything works<\/h2>\n<p>Before you run the app again, you\u2019ll need to add some verbose logging to the console. Choose <strong>Product<\/strong> -&gt; <strong>Scheme<\/strong> -&gt; <strong>Edit scheme<\/strong> from the menu bar.<\/p>\n<div style=\"aspect-ratio: 1562 \/ 756;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/edit-scheme.jpg\" title=\"Edit scheme\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"756\" width=\"1562\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/edit-scheme.jpg#ZgotmplZ\" alt=\"Edit scheme\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>In the <strong>Arguments Passed On Launch<\/strong>, click the plus (<strong>+<\/strong>) symbol to add a new argument, and name it <code>-FIRAnalyticsDebugEnabled<\/code>. This is what it should look like:<\/p>\n<div style=\"aspect-ratio: 1226 \/ 316;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/firanalyticsdebugenabled.jpg\" title=\"-FIRAnalyticsDebugEnabled\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"316\" width=\"1226\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/firanalyticsdebugenabled.jpg#ZgotmplZ\" alt=\"-FIRAnalyticsDebugEnabled\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Now, run the app again. In the console logs, you should find the <code>select_content<\/code> event by either scrolling to it or filtering for the event name.<\/p>\n<div style=\"aspect-ratio: 2192 \/ 846;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-verbose-logs.jpg\" title=\"iOS Verbose logs\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"846\" width=\"2192\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-verbose-logs.jpg#ZgotmplZ\" alt=\"iOS Verbose logs\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>You can now also visit your Google Analytics reporting view for the <strong>App + Web<\/strong> property created for this project, and scroll to the <strong>DebugView<\/strong> report. This will automatically include all devices for which the <code>-FIRAnalyticsDebugEnabled<\/code> flag has been set. You should find your device (maybe with an odd name, though) in the Debug Devices list, and you should see a stream of events in the DebugView, together with the new <code>select_content<\/code> event you just created.<\/p>\n<div style=\"aspect-ratio: 2226 \/ 1564;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-debugview.jpg\" title=\"iOS debugview\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"1564\" width=\"2226\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-debugview.jpg#ZgotmplZ\" alt=\"iOS debugview\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Before we\u2019re done, let\u2019s fork this Firebase Analytics hit using Google Tag Manager, and send the copy to a Universal Analytics endpoint!<\/p>\n<h2 id=\"step-6-create-and-download-a-google-tag-manager-container\">Step 6: Create and download a Google Tag Manager container<\/h2>\n<p>First, make sure you have a valid Universal Analytics endpoint. You need to create a <strong>Web property<\/strong> with a <strong>Mobile App view<\/strong>. The latter is what collects hits sent from your application.<\/p>\n<p>Once you have the tracking ID (<code>UA-XXXXX-Y<\/code>) at hand, you can head on over to <a href=\"https:\/\/tagmanager.google.com\/\">https:\/\/tagmanager.google.com\/<\/a> to create your new iOS container.<\/p>\n<p>In Google Tag Manager, create a new container in one of your accounts, or create a new GTM account first.<\/p>\n<p>Give the container a name, e.g. <strong>My Test Application<\/strong>, and choose <strong>iOS<\/strong> as the type. Click <strong>Create<\/strong> when ready.<\/p>\n<div style=\"aspect-ratio: 1228 \/ 1002;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-create-gtm-container.jpg\" title=\"Create GTM container\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"1002\" width=\"1228\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-create-gtm-container.jpg#ZgotmplZ\" alt=\"Create GTM container\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Click <strong>New Tag<\/strong> to create a new tag. Choose <strong>Google Analytics: Universal Analytics<\/strong> as the tag type.<\/p>\n<p>Select <strong>Event<\/strong> from the Track Type list.<\/p>\n<p>Add something to the <strong>Category<\/strong> field, e.g. <strong>Test Event<\/strong>.<\/p>\n<p>In the <strong>Action<\/strong> field, start typing <code>{{<\/code> and then choose <strong>New Variable<\/strong> from the list.<\/p>\n<div style=\"aspect-ratio: 1586 \/ 1108;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-new-variable.jpg\" title=\"iOS new variable\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"1108\" width=\"1586\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-new-variable.jpg#ZgotmplZ\" alt=\"iOS new variable\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Choose <strong>Event Parameter<\/strong> as the variable type.<\/p>\n<p>Keep <strong>Suggested Firebase Parameter<\/strong> checked, and choose <strong>item_id<\/strong> from the Event Parameter list.<\/p>\n<p>Give the variable a name, e.g. <code>{{item_id}}<\/code> and then click <strong>Save<\/strong>.<\/p>\n<div style=\"aspect-ratio: 2814 \/ 1246;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-create-item-id-parameter.jpg\" title=\"Create item ID parameter\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"1246\" width=\"2814\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-create-item-id-parameter.jpg#ZgotmplZ\" alt=\"Create item ID parameter\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Back in the tag, check <strong>Enable overriding settings in this tag<\/strong>, and add the Google Analytics tracking code for the web property that will be receiving these hits (<code>UA-XXXXXX-Y<\/code>).<\/p>\n<div style=\"aspect-ratio: 1622 \/ 1476;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-tag-settings.jpg\" title=\"iOS tag settings\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"1476\" width=\"1622\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-tag-settings.jpg#ZgotmplZ\" alt=\"iOS tag settings\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Finally, click the <strong>Triggering<\/strong> panel to add a new trigger.<\/p>\n<p>Click the blue plus (<strong>+<\/strong>) sign in the top right corner to create a new trigger.<\/p>\n<p>Choose <strong>Custom<\/strong> as the trigger type.<\/p>\n<p>Check <strong>Some Events<\/strong> under the <strong>This trigger fires<\/strong> on heading.<\/p>\n<p>Set the condition to:<\/p>\n<p><strong>Event Name<\/strong> <em>equals<\/em> <code>select_content<\/code><\/p>\n<p>Give the trigger a name (e.g. <code>select_content<\/code>), and when happy with it, click <strong>Save<\/strong>.<\/p>\n<div style=\"aspect-ratio: 2778 \/ 914;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-new-trigger.jpg\" title=\"iOS new trigger\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"914\" width=\"2778\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-new-trigger.jpg#ZgotmplZ\" alt=\"iOS new trigger\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Double-check to make sure your tag looks like the one below, and then click <strong>Save<\/strong> to return to the Google Tag Manager dashboard.<\/p>\n<div style=\"aspect-ratio: 2766 \/ 1490;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-final-tag.jpg\" title=\"iOS final tag\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"1490\" width=\"2766\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-final-tag.jpg#ZgotmplZ\" alt=\"iOS final tag\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>At this point, you are ready to publish the container, so click <strong>Submit<\/strong> in the top right corner, and then <strong>Publish<\/strong> in the overlay that opens.<\/p>\n<div style=\"aspect-ratio: 2808 \/ 682;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-publish-container.jpg\" title=\"Publish container\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"682\" width=\"2808\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-publish-container.jpg#ZgotmplZ\" alt=\"Publish container\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Once the container has been published, you should see a version overview of the published version. Click the <strong>Download<\/strong> button in this screen to download the container JSON file.<\/p>\n<div style=\"aspect-ratio: 3014 \/ 742;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-download-container.jpg\" title=\"Download container iOS\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"742\" width=\"3014\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-download-container.jpg#ZgotmplZ\" alt=\"Download container iOS\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Now, create a new folder named <strong>container<\/strong> in the <em>root<\/em> of your project (the directory with the <code>.xcodeproj<\/code> and <code>.xcworkspace<\/code> files as well as the <code>Podfile<\/code>). Move the container JSON into this directory.<\/p>\n<div style=\"aspect-ratio: 1036 \/ 606;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-container-in-folder.jpg\" title=\"iOS container in folder\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"606\" width=\"1036\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-container-in-folder.jpg#ZgotmplZ\" alt=\"iOS container in folder\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Next, open Xcode. With your project root selected in the navigator, choose <strong>File<\/strong> \u2013&gt; <strong>Add files to Your Project<\/strong>.<\/p>\n<div style=\"aspect-ratio: 1038 \/ 538;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-add-files.jpg\" title=\"iOS add files\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"538\" width=\"1038\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-add-files.jpg#ZgotmplZ\" alt=\"iOS add files\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Find and select the <strong>container<\/strong> folder from your project root directory, and make sure the other options are checked as in the screenshot below. Click <strong>Add<\/strong> when ready.<\/p>\n<div style=\"aspect-ratio: 1602 \/ 960;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-add-container-to-project.jpg\" title=\"iOS add container to project\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"960\" width=\"1602\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-add-container-to-project.jpg#ZgotmplZ\" alt=\"iOS add container to project\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Once ready, you can <strong>run your application<\/strong>, and it should load the default container you just added to the application, and then shortly after fetch the most recent container version over the network.<\/p>\n<blockquote>\n<p><strong>Note!<\/strong> It\u2019s always a good idea to keep as fresh a container version as the default container stored with the application itself. Thus if there\u2019s network lag impacting the fetch of a more recent container version, the fallback (the default container) would be as up-to-date as possible.<\/p>\n<\/blockquote>\n<p>To be sure, you\u2019ll need to debug the setup a little.<\/p>\n<h2 id=\"step-7-debug-and-test-that-universal-analytics-receives-the-hits\">Step 7: Debug and test that Universal Analytics receives the hits<\/h2>\n<p>Xcode\u2019s logs are a bit of a mess. However, if you\u2019re not averse to scroll-and-search, you can find what you\u2019re looking for. You can also type in text in the filter field to parse the logs, but it only returns matching <em>rows<\/em> and is not thus very helpful.<\/p>\n<p>However, we can quickly see that Google Tag Manager found our container and was able to load it in the application,<\/p>\n<div style=\"aspect-ratio: 694 \/ 436;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/container-loaded.jpg\" title=\"Container loaded\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"436\" width=\"694\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/container-loaded.jpg#ZgotmplZ\" alt=\"Container loaded\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>In addition to that, by scrolling down we can see that a Universal Analytics hit was dispatched via Google Tag Manager, using the parameters we set for the <code>select_content<\/code> event.<\/p>\n<div style=\"aspect-ratio: 677 \/ 146;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-universal-analytics-hit-sent.jpg\" title=\"Universal Analytics hit sent\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"146\" width=\"677\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-universal-analytics-hit-sent.jpg#ZgotmplZ\" alt=\"Universal Analytics hit sent\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Finally, we can check the Real Time report of our mobile app view to confirm data is flowing in:<\/p>\n<div style=\"aspect-ratio: 1268 \/ 405;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-real-time-works.jpg\" title=\"Real Time report shows OK\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"405\" width=\"1268\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/08\/ios-real-time-works.jpg#ZgotmplZ\" alt=\"Real Time report shows OK\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Debugging a mobile application is notoriously difficult. If you want to do it seriously, you might want to use a tool like <a href=\"https:\/\/www.charlesproxy.com\/\">Charles proxy<\/a>, which creates a log stream of all the network requests dispatched by your mobile application. You don\u2019t even need source code access to make it work!<\/p>\n<h2 id=\"summary\">Summary<\/h2>\n<p>As with my <a href=\"https:\/\/www.simoahava.com\/analytics\/android-quickstart-google-analytics-firebase-google-tag-manager\/\">Android guide<\/a>, this article should really be an introduction to iOS development, and not a full-blown tutorial.<\/p>\n<p>The purpose is to give you the <strong>tools<\/strong> and <strong>confidence<\/strong> to start working with mobile app development. Understanding the capabilities and limitations of Firebase is fundamental to being able to fluently work with the ecosystem.<\/p>\n<p>Working with mobile application development is far removed from web development. For starters, the IDEs, SDKs, and programming languages at your disposal are far more restrictive than the wild west that is the web browser.<\/p>\n<p>Kotlin and Swift do not let you do all the crazy stuff you can do with JavaScript, and there are also restrictions what types of shenanigans can be executed at runtime (so no Custom HTML tags in mobile app containers).<\/p>\n<p>Nevertheless, iOS development has its charms, and Xcode can be a great ally in the times when it\u2019s not a complete pain in the butt.<\/p>\n<p>The beauty of mobile application development is how quickly you can get started. You don\u2019t need anything extravagant &#8211; just a machine capable of handling the virtual devices, some good tutorials, and a solid system such as Firebase picking up some of the slack.<\/p>\n<p>As always, I\u2019m looking forward to your feedback in the comments! I\u2019m sure I\u2019ll revisit Firebase many times in upcoming articles.<\/p>\n<\/p><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>A while ago, I published an article on how to build an Android application, and bundle it with Firebase. The purpose of that article, and the one you are reading now, is to slowly introduce the world of mobile app development and Firebase, given the latter is getting more and more traction as Google\u2019s go-to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":96321,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[12765,43926,1531,3554,14495,45593,1791],"dealstore":[],"offerexpiration":[],"class_list":["post-96320","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-analytics","tag-firebase","tag-google","tag-ios","tag-manager","tag-quickstart","tag-tag"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>iOS Quickstart With Google Analytics For Firebase And Google Tag Manager - Som2ny Network<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fivemor.com\/?p=96320\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"iOS Quickstart With Google Analytics For Firebase And Google Tag Manager - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"A while ago, I published an article on how to build an Android application, and bundle it with Firebase. The purpose of that article, and the one you are reading now, is to slowly introduce the world of mobile app development and Firebase, given the latter is getting more and more traction as Google\u2019s go-to [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=96320\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-18T23:20:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/ios-process.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1371\" \/>\n\t<meta property=\"og:image:height\" content=\"463\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=96320#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=96320\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"iOS Quickstart With Google Analytics For Firebase And Google Tag Manager\",\"datePublished\":\"2025-02-18T23:20:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=96320\"},\"wordCount\":2868,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=96320#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/ios-process.jpg\",\"keywords\":[\"Analytics\",\"Firebase\",\"Google\",\"iOS\",\"Manager\",\"Quickstart\",\"TAG\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=96320#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=96320\",\"url\":\"https:\/\/fivemor.com\/?p=96320\",\"name\":\"iOS Quickstart With Google Analytics For Firebase And Google Tag Manager - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=96320#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=96320#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/ios-process.jpg\",\"datePublished\":\"2025-02-18T23:20:34+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=96320#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=96320\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=96320#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/ios-process.jpg\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/ios-process.jpg\",\"width\":1371,\"height\":463},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=96320#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"iOS Quickstart With Google Analytics For Firebase And Google Tag Manager\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fivemor.com\/#website\",\"url\":\"https:\/\/fivemor.com\/\",\"name\":\"Som2ny Network\",\"description\":\"Daily Deals\",\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fivemor.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/fivemor.com\/#organization\",\"name\":\"Som2ny Network\",\"url\":\"https:\/\/fivemor.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"width\":300,\"height\":86,\"caption\":\"Som2ny Network\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/fivemor.com\"],\"url\":\"https:\/\/fivemor.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"iOS Quickstart With Google Analytics For Firebase And Google Tag Manager - Som2ny Network","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:\/\/fivemor.com\/?p=96320","og_locale":"en_US","og_type":"article","og_title":"iOS Quickstart With Google Analytics For Firebase And Google Tag Manager - Som2ny Network","og_description":"A while ago, I published an article on how to build an Android application, and bundle it with Firebase. The purpose of that article, and the one you are reading now, is to slowly introduce the world of mobile app development and Firebase, given the latter is getting more and more traction as Google\u2019s go-to [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=96320","og_site_name":"Som2ny Network","article_published_time":"2025-02-18T23:20:34+00:00","og_image":[{"width":1371,"height":463,"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/ios-process.jpg","type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=96320#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=96320"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"iOS Quickstart With Google Analytics For Firebase And Google Tag Manager","datePublished":"2025-02-18T23:20:34+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=96320"},"wordCount":2868,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=96320#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/ios-process.jpg","keywords":["Analytics","Firebase","Google","iOS","Manager","Quickstart","TAG"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=96320#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=96320","url":"https:\/\/fivemor.com\/?p=96320","name":"iOS Quickstart With Google Analytics For Firebase And Google Tag Manager - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=96320#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=96320#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/ios-process.jpg","datePublished":"2025-02-18T23:20:34+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=96320#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=96320"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=96320#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/ios-process.jpg","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/ios-process.jpg","width":1371,"height":463},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=96320#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"iOS Quickstart With Google Analytics For Firebase And Google Tag Manager"}]},{"@type":"WebSite","@id":"https:\/\/fivemor.com\/#website","url":"https:\/\/fivemor.com\/","name":"Som2ny Network","description":"Daily Deals","publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fivemor.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fivemor.com\/#organization","name":"Som2ny Network","url":"https:\/\/fivemor.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","width":300,"height":86,"caption":"Som2ny Network"},"image":{"@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","caption":"admin"},"sameAs":["https:\/\/fivemor.com"],"url":"https:\/\/fivemor.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/96320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=96320"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/96320\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/96321"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=96320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=96320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=96320"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=96320"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=96320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}