Google Analytics in Chrome Packaged Apps

• 1 min read

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 🤗

Now look what you've done 🌋
Stop clicking and run for your life! 😱
Uh oh, I don't think the system can't handle it! 🔥
Stop it, you're too kind 😄
Thanks for the love! ❤️
Thanks, glad you enjoyed it! Care to share?
Hacker News Reddit

×

Recommended Posts ✍🏻

See All »
• 3 min read
✨ HTML Share Buttons
Read Post »
• 3 min read
🚅 Next Stop, Yaak
Read Post »
• 4 min read
💻 Wait for User to Stop Typing, in JavaScript
Read Post »