Google Analytics in Chrome Packaged Apps
tl;dr use the Chrome Platform Analytics Library.
Today I released my first Chrome Packaged App. When I first set out to build a packaged app I didn’t know how restrictive it would be. For security reasons, Google disallows a lot of behavior that is usually acceptable in regular web development. One of these behaviors is the execution of external scripts, such as Google Analytics.
After spending a while on Google, I figured out how to properly use Google Analytics in a Chrome Packaged App. Here’s how…
Google has a Github repository called Chrome Platform Analytics. This repo contains a JavaScript library that can be downloaded and included as a local script in any packaged app. This gets around the external script restriction.
The wiki provides all the instructions needed to get started.
If you enjoyed this tutorial, please consider sponsoring my work on GitHub 🤗