How to tell if a Chrome extension is installed by a real user vs. by me during development?

后端 未结 2 426
有刺的猬
有刺的猬 2021-01-13 10:03

I\'m using Analytics in my Chrome extension. I want to execute the analytics code only if the extension is being used by a real person (not me while I\'m working on it). Are

相关标签:
2条回答
  • 2021-01-13 10:44

    Your production extension will have a single extension_id that will not change while your unpacked extension will have a random extension_id that will change if you remove and load it again. You can use the il8n API to get the extension_id check if it matches the production extension_id.

    var extensionId = chrome.i18n.getMessage('@@extension_id');

    0 讨论(0)
  • 2021-01-13 10:55

    You can install the Google Analytics opt-out https://chrome.google.com/webstore/detail/fllaojicojecljbmefodhfapmkghcbnh?hl=en

    0 讨论(0)
提交回复
热议问题