title: Can I use Firebase Analytic Web SDK for a Cordova App?
body: <p>I'm developing a cross platform app: Web, PWA, iOS (Cordova) &amp; Android (Cordova).</p>
  
  <p>I use the same code base, and Firestore &amp; Auth are working well on all the platforms using only the Web SDK.</p>
  
  <p>However, when I add the Firebase Analytic plugin, it works as expected on the Web / PWA, but the iOS / Android apps do not seem to send back anything.</p>
  
  <p><strong>Is there a way to make Analytic works using only the Web SDK? Or is it mandatory to use a Cordova Plugin?</strong></p>
  
  <p>Thank you in advance for your help.</p>
  
  <p>Note: I'm using Framework7 &amp; VueJS</p>
  
  <hr>
  
  <h3>Edit 1</h3>
  
  <p>It seems that cordova is officially supported for analytic with the web SDK. </p>
  
  <p><strong>So the question becomes: do you have any idea why the implementation is working for "normal" app and break when on cordova?</strong></p>
  
  <p><a href="https://firebase.google.com/support/guides/environments_js-sdk#other_environments" rel="nofollow noreferrer">https://firebase.google.com/support/guides/environments_js-sdk#other_environments</a></p>
  
  <hr>
  
  <h3>Edit 2</h3>
  
  <p>Now that I know that it should work, I'm trying harder to find solutions. </p>
  
  <p>First, I observed in the Safari Console that on y web app, I can observe calls to <a href="https://www.google-analytics.com/g/collect" rel="nofollow noreferrer">https://www.google-analytics.com/g/collect</a> every time I'm logging an event. </p>
  
  <p>I do not observe those calls on the Cordova app, which is most probably the reason why I do not receive anything in my Firebase Analytics.</p>
  
  <p><strong>The question becomes: why are those call not made in cordova, considering the js the same?</strong></p>
  
  <hr>
  
  <h3>Edit 3</h3>
  
  <p>Ok, I think I found the explanation:
  <a href="https://stackoverflow.com/questions/3591847/google-analytics-from-a-file-url/47251006#47251006">Google Analytics from a file:// url</a></p>
  
  <p><strong>The question becomes: since Analytic is loaded automatically with firebase, how can I make this configuration?</strong> </p>
  
  <p>Ideally, I would like a way to set the client id using a hash of my user uuid (as I said in my post, I'm using Firebase Auth). </p>
  
  <p>How can I dynamically change the value each time a user connect to the app? Can Firebase directly take care of this? </p>