admin管理员组文章数量:1428986
I can't seem to get Segment to work despite following these instructions: /
When I run analytics.track
, I don't see any network requests for the tracking pixels but I don't see any error either. The analytics
object exists, but it doesn't seem to do anything.
It's important to note here that I'd like to run Segment from the context of the page. My extension injects new DOM elements and CSS styles into the webpage and I want to track the user's interactions with these elements. So Segment is not running in the context of the extension at all. It's injected into the page's head
as a script
.
I can't seem to get Segment to work despite following these instructions: https://segment./docs/platforms/chrome-extension/
When I run analytics.track
, I don't see any network requests for the tracking pixels but I don't see any error either. The analytics
object exists, but it doesn't seem to do anything.
It's important to note here that I'd like to run Segment from the context of the page. My extension injects new DOM elements and CSS styles into the webpage and I want to track the user's interactions with these elements. So Segment is not running in the context of the extension at all. It's injected into the page's head
as a script
.
2 Answers
Reset to default 4Steven here from Segment. We remend loading analytics.js on a background page, so as not to interfere with the analytics tools that have already been loaded onto the page. In either case, you would do the following:
Create a file called snippet.js with the analytics.js snippet inside it.
Inject the file onto the current page:
chrome.tabs.executeScript(null, {file: 'snippet.js'});
According to the following link, segment how to do this
In 2018 we fully deprecated and stopped supporting the following Segment source “plugins”:
You can now refer use their npm package for this. Here is the link on the steps
本文标签: javascriptUsing Segment IO in Chrome ExtensionStack Overflow
版权声明:本文标题:javascript - Using Segment IO in Chrome Extension - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745528849a2661966.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论