firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.66k stars 1.49k forks source link

Link a session from the web (gtag.js) to the native Firebase without Dynamic Link #9817

Closed sneko closed 1 year ago

sneko commented 2 years ago

Feature proposal

Hi,

It may be or not a feature request depending on your answer, so sorry in advance if it's not!

In the past I was using Firebase Dynamic Link (and it was making the brige between the web (gtag.js) and the native side (Firebase Analytics)) and I was able to see the same user session across web and app.

I'm now in the case where I need to use tool not owned by Google to make links from "web to native" to track flows when the user come from specific ad platform (Facebook, Tiktok...). (I would have loved to stick with Firebase Dynamic Link but it's blocking in case of flows after an ad clicked from web to native app...)

But in this case where I use another "link creator", how could I propagate the "google session id" from the web to the app? I thought about:

  1. from the website, when the user clicks the native app link, I generate the hybrid link with the "third-party link creator" while adding to the original destination a parameter like _ga that I can read thanks to gtag.js (or maybe the cookie if available)
  2. once the app is launched or installed, I can ask the "link creator SDK" which was the original link (the link containing _ga)
  3. I extract this parameter from the original link
  4. I set into the Firebase Analytics SDK this parameter (something like setSessionId(...)) so Firebase can tells Google Analytics it's the same session

But from what I see into the Firebase Analytics SDK I'm not able to specify the session id (for cross-platform session).

Do you know how I could proceed to keep the session from web to native into Google Analytics? I'm wondering how Firebase Dynamic Link was proceeding (a parameter must have been passed somewhere... otherwise it's all handled on Google servers)?

cc @paulb777

google-oss-bot commented 2 years ago

I found a few problems with this issue:

morganchen12 commented 2 years ago

@sneko, Firebase Dynamic Links used the pasteboard previously to store link information on the device from App Store to downloaded app. If you have your own website with a manual universal links implementation, you could do the same.

sneko commented 2 years ago

@morganchen12 I understand what you mean but how could I tell the Firebase SDK to init with a specific session ID?

As mentioned above I read the docs and never found any setSessionId(...) available.

Thank you,

morganchen12 commented 2 years ago

Analytics does not let you manually set the session ID. You'd have to find some other way of identifying the user across platforms and then manually combine the data, for example via BigQuery export.

paulb777 commented 1 year ago

It's not clear there are additional actions here. Please comment if there's an open question.

google-oss-bot commented 1 year ago

Hey @sneko. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 1 year ago

Since there haven't been any recent updates here, I am going to close this issue.

@sneko if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.