Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to integrate amp-analytics with Firebase Analytics #31009

Closed
gerardorn opened this issue Nov 5, 2020 · 3 comments
Closed

Failed to integrate amp-analytics with Firebase Analytics #31009

gerardorn opened this issue Nov 5, 2020 · 3 comments

Comments

@gerardorn
Copy link

What's the issue?

When integrating AMP with Firebase Analytics no information is registered

How do we reproduce the issue?

  1. Create a firebase project with a new Analytics Account in the Firebase Console
  2. Register a web application with Firebase Hosting enabled
  3. Initialize a local Firebase Project with the Firebase CLI with Hosting integration
  4. Create a simple AMP page using the amp-analytics element inside the public directory
  5. Configure the amp-analytics tag to reference the Firebase Analytics measurementId
  6. Serve localy the firebase project with firebase serve
  7. Visit the localhost url to the AMP page
  8. Review there's no information registered in Firebase Analytics

According to the Firebase Analytics documentation, the firebase SDK and the Firebase Analytics library must be referenced via <script> elements in the code:

<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.0.0/firebase-app.js"></script>

<!-- TODO: Add SDKs for Firebase products that you want to use
     https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/8.0.0/firebase-analytics.js"></script>

before calling:

firebase.initializeApp(firebaseConfig);
firebase.analytics()

Doing this invalidates the AMP page.

Maybe Firebase should be a provider for amp-analytics. Passing the required information about the project, the amp-analytics tag could initialize the application and the analytics product so the events are registered successfully

Tips on Rendering Bugs

Not required (?)

What browsers are affected?

Used Chrome while developing but it's not related to the browser

Which AMP version is affected?

The console prints: Powered by AMP ⚡ HTML – Version 2010132225003

@micajuine-ho
Copy link
Contributor

Hi @gerardorn , thank you for your issue.

Firebase currently does not have an integration with amp-analytics. For a list of vendors that do integrate with amp-analytics, please see here.

@gerardorn
Copy link
Author

Hey @micajuine-ho
Thanks for the reply

It would be nice to have or maybe an example of how to integrate them if thats possible

@gerardorn
Copy link
Author

I've found an issue that might be related
#30903 (comment)

Thanks @micajuine-ho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants