-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow cdn in AnalyticsSettings #362
Comments
Hi @chambo-e, good suggestion. We are planning to improve the configurability of the library for |
Thanks :) By any chance do you have a public roadmap which would allow us to close this issue ? |
Any updates on this one? |
Thanks for checking! We just released this feature in 1.34.0. |
@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? |
@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! |
@pooyaj I created a PR for it, let me know if that works |
I am using the v1.35.0 of 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;
}; |
@silesky I am loading 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.
|
hey @vicpara, the expected behavior for setting |
If you see |
@pooyaj Thanks for your answer and for looking into this. Currently I see the following assets still being downloaded from the segment cdn:
|
I see! then it is a bug on our end 😅 we will look into it and hopefully should be able to release the fix |
…tio#414) * feat: add support for configuring CDN fixes segmentio#362 * feat: continue adding support for configuring CDN, fixes segmentio#362 Co-authored-by: Yordis Prieto Lazo <yordis.prieto@gmail.com>
Hello 👋
If I understand correctly the current way to set the cdn is this
Because this variable can then be reused in the plugins
We try to avoid touching the window object as much as possible
Would it be possible to pass the cdn in the AnalyticsSettings which is then passed down to the plugins ?
Thanks :)
The text was updated successfully, but these errors were encountered: