segment-integrations / analytics.js-integration-amplitude Goto Github PK
View Code? Open in Web Editor NEWThe Amplitude analytics.js integration.
Home Page: https://segment.com/docs/integrations/amplitude/
License: MIT License
The Amplitude analytics.js integration.
Home Page: https://segment.com/docs/integrations/amplitude/
License: MIT License
The options declared here - https://github.com/segment-integrations/analytics.js-integration-amplitude/blob/master/lib/index.js#L35-L37 are never actually set on the Amplitude library.
We should set them when we initialize the library here https://github.com/segment-integrations/analytics.js-integration-amplitude/blob/master/lib/index.js#L54-L57.
If I enable trackAllPages and then fire .page with a named page it ends up sending two events to amplitude. This is because the page event does not return after firing the first. Is this behavior expected?
For example:
If my configuration has:
"Amplitude": {
apiKey: "[blah]",
trackAllPages: true,
saveEvents: true,
includeUtm: true,
includeReferrer: true,
includeGclid: true,
saveParamsReferrerOncePerSession: false,
domain: "." + document.location.host
},
And I call analytics.page('test')
The code first hits https://github.com/segment-integrations/analytics.js-integration-amplitude/blame/master/lib/index.js#L125
// all pages
if (opts.trackAllPages) {
this.track(page.track());
}
This sends an event to amplitude with event_type: "Loaded a Page" (per what's in analytics.js)
and then gets to https://github.com/segment-integrations/analytics.js-integration-amplitude/blob/master/lib/index.js#L134
// named pages
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
Which then sends another event to amplitude with the event_type: "Viewed test Page"
Would it make more sense to have the trackAllPages add the name or category if present and return? e.g.
// all pages
if (opts.trackAllPages) {
if(category){
return this.track(page.track(category));
}
if(name){
return this.track(page.track(name));
}
return this.track(page.track());
}
Kind of gross, I know.
Currently at 2.1.0
, a PR came in to bump it to 2.2.0
, but needs to not pull in a gzipped version and testing needs to be done to ensure it'll work.
More details here: 5f420f7
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.