0
votes

I would like to know how to make it works because just paste the code in the app doesn't work.

The code generated by analytics is this:

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXXX-X', 'auto');
ga('send', 'pageview');

but it doesn't work because "content_security_polict" only accept HTTPS and not HTTP.

  • I tried to config the path in "permission" too:

{ ... "permissions": ["https://www.google-analytics.com/analytics.js"] ... }

but it doesn't workt too.

  • I tried to set HTTPS fixed in the analytics code, but doesn't work too.

In a normal web page, it loads two files:

enter image description here

but in my app, it loads only one:

enter image description here

How can I make it works?

1
Please include your full current manifest. - abraham
@abraham This was the manifest I was using: github.com/Kunze/Pomodoro-app-chrome/commit/… - MuriloKunze
@abraham In the commit I changed the code generated by analytics with another code(developer.chrome.com/extensions/examples/tutorials/analytics/…) and then my app works. - MuriloKunze

1 Answers

1
votes

You can also try the library made specifically for Chrome apps and extensions. https://github.com/GoogleChrome/chrome-platform-analytics