We're sorry, but anonymous users are not allowed to create a new post.
Please Login or Register a new account.
Artboard 2 Q&A Artboard 2 copy 2Ideas Artboard 2 copyHelp Center
  • Log In
  • Home
  • Planning and Implementation Spec

We've been hard at work — check out our latest product updates.

question
avatar image
stephanie_MixpanelTeam asked · Jul 29 at 10:39 PM

Implement Mixpanel In A Chrome Extension - Articles From the Archive

Each week, Mixpanel will release articles from our archives to help you get the most out of Mixpanel. Follow the Topic Tag #fromthearchive to subscribe to these posts and get alerted when they drop.


While Mixpanel doesn’t specifically have a library for implementation on Chrome Extensions, it is certainly possible to use Mixpanel to track user actions within a Google Chrome Extension. Many customers have successfully integrated using either the JavaScript library or directly via the HTTP API.


JavaScript

Implementing via the JavaScript library has some advantages, namely that it collects several default properties by default that you can use to learn more about your users. You can find full documentation for using the Mixpanel JavaScript library here.

In addition to reviewing the standard JavaScript implementation documentation, a few tips specific to Chrome Extensions:

  • Paste the Mixpanel JavaScript code snippet and your project's token within the mixpanel.init()function within the <head> tags at the top of the JavaScript file you will be loading within your extension.

  • Place tracking code in the <body> tags in between <script> tags.

  • Some users have reported receiving an error similar to the following in the console when implementing with the JavaScript library, which is related to Chrome’s Content Security Policy: "Mixpanel error: 'mixpanel' object not initialized. Ensure you are using the latest version of the Mixpanel JS Library along with the snippet we provide.”

  • Chrome requires extensions to load remote resources over HTTPS, so to resolve the error and force all XHR requests sent from your Mixpanel implementation to be sent via HTTPS rather than HTTP, make the following addendum to the mixpanel.init() function:

mixpanel.init("your token",{api_host:"https://api.mixpanel.com"})


HTTP

As an alternative to the JavaScript library, use Mixpanel’s HTTP Tracking API with Chrome Extensions to craft and send your own Mixpanel track calls.

fromthearchiveimplementationgoogle chrome extension
Comment

People who like this

0 Show 0
5 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 8 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.

0 Answers


question details

1 Person is following this question.

avatar image
Answers Answers and Comments

Related Questions

Difference between register and people.set? 1 Answer

Implement Mixpanel on Wordpress, Shopify, PrestaShop & Google Sites- Articles From the Archive 0 Answers

Server-side Implementation? 1 Answer

Track Mixpanel Inside Canvas or iFrame - Articles From the Archive 0 Answers

Fetch data from external list 2 Answers

Features
  • Engagement
  • Retention
  • Funnels
  • People
  • Automatic Insights
  • Mobile A/B Testing
  • Messages
  • Infrastructure
  • Platform
  • JQL
Solutions
  • Enterprise
  • SaaS
  • Financial Services
  • Consumer Tech
  • Media & Entertainment
  • Telecommunications
  • Retail & E-commerce
  • Product
  • Marketing
  • Analytics
  • Professional Services
Resources
  • Help Center
  • Mixpanel Blog
  • Case Studies
  • Reports
  • Product Updates
  • Events & Webinars
  • Pricing
  • Partners
  • Trends
  • API & Developers
  • Live Webinars
Company
  • About us
  • Careers
  • Legal
  • Contact us
Follow

  • Anonymous
  • Log In
  • Create
  • Ask a question
  • Post an idea
  • Spaces
  • Planning and Implementation Spec
  • Data Management
  • Sending data to Mixpanel
  • Building Analysis Reports
  • Messages
  • Pulling data out of Mixpanel
  • Ideas
  • Tell us how you approach Analytic Strategies
  • Tell us how you use Mixpanel
  • Project Admin
  • Questions about our Community Platform
  • Explore
  • Topics
  • Questions
  • Ideas
  • Users
  • Badges