5
votes

I am in need to implement Firebase+Google Tag manager for GoogleAnalytics in my iOS App.

I tried a POC on a blank iOS project by installing pods for GoogleTagManager and Firebase/Core with the latest versions. The POC works fine, I am able to send the events and the events get logged to the GA on server.

However, when I installed GTM and Firebase/Core with latest versions, same GoogleServices-info.plist, same GTM-XXXXXXX.json, I found that my application crashes and I could see "GoogleTagManager info: Loading container: GTM-XXXXXXX" as the last line in my console.

Removing GoogleInterchangeUtilities
Downloading dependencies
Installing Firebase 4.3.0 (was 3.7.1)
Installing FirebaseAnalytics 4.0.4 (was 3.4.4)
Installing FirebaseCore 4.0.8 (was 3.4.3)
Installing FirebaseInstanceID 2.0.4 (was 1.0.9)
Using GoogleAnalytics (3.17.0)
Using GoogleSymbolUtilities (1.1.2)
Installing GoogleTagManager 6.0.0 (was 5.0.8)
Installing GoogleToolboxForMac (2.1.3)
Using GoogleUtilities (1.3.2)
Installing nanopb (0.3.8)

When I removed GoogleTagManager and kept only FirebaseAnalytics, the application worked fine and Firebase Analytics was receiving the events on server.

Went through the different threads on different forums and stack overflow, I tried downgrading GTM and Firebase to GoogleTagManager -v5.0.8 and Firebase/Core -v3.7.1 and FirebaseAnalytics. Please note, I did not mention any preferred version for FirebaseAnalytics. Much to my surprise my application started working and did not break anywhere. However, now I see, Firebase events are firing, but the GA is not receiving any events. Also, I see in my console that the parameters to the events are passed as null.

GoogleTagManager info: Processing logged event: gtm.load with parameters: (null)

Pod Install logs -

Downloading dependencies
Installing Firebase 3.7.1 (was 4.3.0)
Installing FirebaseAnalytics 3.4.4 (was 4.0.4)
Installing FirebaseCore 3.4.3 (was 4.0.8)
Installing FirebaseInstanceID 1.0.9 (was 2.0.4)
Using GoogleAnalytics (3.17.0)
Installing GoogleInterchangeUtilities (1.2.2)
Using GoogleSymbolUtilities (1.1.2)
Installing GoogleTagManager 5.0.8 (was 6.0.0)
Using GoogleUtilities (1.3.2)

I'm not sure what is going wrong in my application. Which library is conflicting with Firebase or GoogleTagManager? The same setup works fine on a blank project.

My app uses other bunch of other frameworks that are manually added (not through Cocoapods) - AWS Frameworks, CyptoSwift, DropDown, Timberjack, Alamofire, Charts, Gloss, SwiftValidator, SwiftyJSON, SDWebImage, AWSFacebookSignIn, AWSGoogleSignIn, Blots, FBSDKCoreKit, FBSDKLoginKit, GoogleAppUtilities, GoogleAuthUtilities, GoogleNetworkUtilities, GoogleSignin, SafariServices.

Hope that helps to identify the conflict if any.

The reason I say conflict is because the latest versions of GoogleTagManager and Firebase works fine in the blank app POC that I did with the same GoogleServices-info.plist and GTM-XXXXXXX.json file. Also, the app works when I downgrade the versions of GTM and Firebase, however in that case the GA stops receiving the events.

Console Logs:

Oct 17 09:39:30 XX-Shell[88944] : [Firebase/Core][I-COR000005] No app has been configured yet.

Oct 17 09:39:30 XX-Shell[88944] : [Firebase/Analytics][I-ACS024000] Debug mode is on

Oct 17 09:39:30 XX-Shell[88944] : [Firebase/Analytics][I-ACS023008] To disable debug logging set the following application argument: -noFIRAnalyticsDebugEnabled

Oct 17 09:39:30 XX-Shell[88944] : [Firebase/Analytics][I-ACS023009] Debug logging enabled

Oct 17 09:39:30 XX-Shell[88944] : [Firebase/Core][I-COR000005] No app has been configured yet.

2017-10-17 09:39:30.349 XX-Shell[88944:5891923] GoogleTagManager info: Loading container: GTM-XXXXXXX

initializingUserPool2017-10-17 09:39:30.352 XX-Shell[88944:5891910] GoogleTagManager info: Attempting to load container GTM-XXXXXXX from network

Oct 17 09:39:30 XX-Shell[88944] : [Firebase/Analytics][I-ACS025018] Event not logged. Call +[FIRApp configure]: gtmTrackEvent_screenView

Update: 26Oct2017

I found the conflicting libraries - GoogleUtilities, GoogleNetworkingUtilities and GoogleSymbolUtilities. I copied all my project releated framework in my poc and i was able to replicate the issue. I started removing one library at a time and i circled on these 3 libraries causing problem (when they are together). Hope google will look into this issue and have an update soon. My problem with actual project is, i have too many sub projects in it and i will have to resolve conflicts (google and other) all together for all the sub projects.. and that is a tedious task, :)

2
Have you filed issue at github.com/firebase/firebase-ios-sdk/issues? Also, please provide some debug log. Thanksadbitx
Updated comments with the console logs. The application crashes but the crash logs are not generated by the simulator under DiagnosticReports folder.Deepak Badiger
@DeepakBadiger Have you ever managed to make it work with the latest Firebase version? Or did you just settle for downgraded version? We're updating our GTM to latest, and this is what happened. Still looking for a solution. We would prefer using the latest version since we plan to integrate FirebaseMessaging as well.Psylocke
@Psylocke, i managed to move all the dependencies on private cocoapods and i was able to get it to work with the latest GTM.Deepak Badiger
@DeepakBadiger, do you mean, you manually added the static frameworks into your xcode project after installing them separately via cocoapods? We install cocoapods in a separate project. Then just manually add the static frameworks into our official project but we are crashing at launch. Here's what I did, perhaps you have an idea what was causing the issue? stackoverflow.com/questions/53207733/…Psylocke

2 Answers

0
votes

Is there any way to isolate where the conflict may be, perhaps by removing libraries? It would also help if you could get a stack trace from when the crash occurs.

0
votes

I think the issue might be coming from the GTM container. If you updated the container and updated the JSON, this might have effected the application. Try removing the container which you updated. This might resolve the issue temporarily.