Comments (16)
Hi @chambo-e, good suggestion. We are planning to improve the configurability of the library for npm
users. Took a note of the _cdn
variable as well to be included in the scope. This won't land immediately, but we are pushing to ship this quarter.
from analytics-next.
@yordis my bad closing this, as passing hardcoded settings won't solve this particular issue. I think we still need to implement passing custom CDN endpoint for proxy users 😅 hopefully coming up soon!
from analytics-next.
@pooyaj I created a PR for it, let me know if that works
from analytics-next.
I see! then it is a bug on our end 😅 we will look into it and hopefully should be able to release the fix
from analytics-next.
@vicpara working on this in #424
from analytics-next.
Thanks :)
By any chance do you have a public roadmap which would allow us to close this issue ?
from analytics-next.
Any updates on this one?
from analytics-next.
Thanks for checking! We just released this feature in 1.34.0.
More info:
PR: #389
Release: https://github.com/segmentio/analytics-next/releases/tag/v1.34.0
from analytics-next.
@pooyaj I am a bit confused because I do want to hit the CDN to retrieve such information just that we need to use our Proxy Server to bypass problems with Ad Blockers and whatnot.
Are you suggesting that we do the CDN call on our side now?
from analytics-next.
I am using the v1.35.0 of @analytics-next
that includes this fix. I can see on the network how settings
is retrieved from the custom domain cdn via the cdnURL
property.
On the other hand, we are using Segment with other 3rd party providers (eg. MouseFlow ). Even though the CDN is correctly configured I can see on the network how other 3rd party resources are still retrieved from segment CDN instead of using the customer proxy url. (eg. https://cdn.segment.com/next-integrations/integrations/mouseflow/2.2.3/mouseflow.dynamic.js.gz )
Do you have any further guidance on how to force the integrations to rely on the custom proxy cdn ?
Thanks
from analytics-next.
I am using the v1.35.0 of
@analytics-next
that includes this fix. I can see on the network howsettings
is retrieved from the custom domain cdn via thecdnURL
property.On the other hand, we are using Segment with other 3rd party providers (eg. MouseFlow ). Even though the CDN is correctly configured I can see on the network how other 3rd party resources are still retrieved from segment CDN instead of using the customer proxy url. (eg. https://cdn.segment.com/next-integrations/integrations/mouseflow/2.2.3/mouseflow.dynamic.js.gz )
Do you have any further guidance on how to force the integrations to rely on the custom proxy cdn ?
Thanks
@vicpara thanks for bringing this up, we're looking into this. In the meantime, does this work (assuming React)?
const useAnalytics = (writeKey: string) => {
const [analytics, setAnalytics] = React.useState<Analytics | undefined>(
undefined
);
useEffect(() => {
const loadAnalytics = async () => {
try {
if (staging) {
(globalThis as any).analytics = {
_cdn: "https://cdn.foo.com",
};
}
const [response, ctx] = await AnalyticsBrowser.load({
writeKey,
});
setAnalytics(response);
} catch (err) {
console.error(err);
}
};
loadAnalytics();
}, [writeKey]);
return analytics;
};
from analytics-next.
@silesky I am loading analytics-next
in React via npm package manager and I set the cdn in the .load method like shown below. This works well for Segment artifacts but not for the 3rd party plugins. In this I followed your support team's guidance.
AnalyticsBrowser.load(
{
writeKey: '12..34',
cdnURL: 'https://cdn.customdomain.com',
},
{
integrations: {
'Segment.io': {
apiHost: 'api.customdomain.com/v1',
},
},
}
)
I checked 'https://github.com/segmentio/analytics.js-integrations/blob/master/integrations/mouseflow/lib/index.js' which shows that the actual integration has a hardcoded url.
- I'm not sure if this link from
analytics.js-integration
is still relevant to this particular topic. - Wanted to check you don't have any magic flag or setting that would rewrite the plugin source based on the CDN hostname.
from analytics-next.
Wanted to check you don't have any magic flag or setting that would rewrite the plugin source based on the CDN hostname.
@vicpara Thanks for sleuthing; maybe @pooyaj can chime in on and confirm if this is something that's possible anywhere in Segment?
from analytics-next.
hey @vicpara, the expected behavior for setting cdnURL
is that all assets that were previously being loaded from cdn.segment.com
should now be loaded from cdn.customdomain.com
including mouseflow.dynamic.js.gz
. But the actual mouseflow SDK ( that is referenced in the plugin source code ) will still load from cdn.mouseflow.com
.
from analytics-next.
If you see mouseflow.dynamic.js.gz
is being loaded from cdn.segment.com
then we have to take a look at it
from analytics-next.
@pooyaj Thanks for your answer and for looking into this.
Currently I see the following assets still being downloaded from the segment cdn:
https://cdn.segment.com/next-integrations/integrations/mouseflow/2.2.3/mouseflow.dynamic.js.gz
https://cdn.segment.com/next-integrations/integrations/vendor/commons.5xxxxxxe.js.gz
commons.5xxxxxxe
is an actual longer string that looks like it can be used as an identifier. I redacted it for this reason. If it helps I am happy to share it with you.
from analytics-next.
Related Issues (20)
- In a sandboxed environment, addEventListener may not behave as expected
- Protocol support for batching?
- Mocking with Jest or Vitest is VERY hard HOT 1
- [Feature Request] Add ability to listen to identity changes HOT 3
- Delete
- ReferenceError: getGlobalCDNUrl function window is not defined HOT 3
- DestinationMiddlewareFunction type is missing from export HOT 1
- Feature request to expose fetch mechanism? HOT 3
- Track method missing events in source debugger HOT 2
- Missing return types and promises not awaited HOT 5
- Provide a way to lazy load AnalyticsBrowser without pulling in all the other dependencies HOT 4
- SSR broke in v1.58.0 HOT 6
- Segment broke with next js 13.5.2 HOT 3
- Segment is not loaded when OneTrust consent integration is setup and jurisdiction does not require a banner to be shown. HOT 4
- OneTrust integration - support a required group for loading a.js HOT 3
- Destination filters only applying *sometimes*? HOT 2
- Delete
- Metrics Calls When using a Proxy HOT 1
- support flush on demand for node.js client HOT 2
- Update vulnerable axios version in `@segment/analytics-node` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from analytics-next.