Analytics: Add option to pass destSDKBaseURL to rudderstack load method (#74926)

* Add option to pass destSDKBaseURL to rudderstack load method

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

---------

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
This commit is contained in:
William Assis 2023-10-23 08:43:33 -04:00 committed by GitHub
parent 51bc84673d
commit 65a7bddcee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 28 additions and 5 deletions

View File

@ -279,6 +279,9 @@ rudderstack_sdk_url =
# Rudderstack Config url, optional, used by Rudderstack SDK to fetch source config
rudderstack_config_url =
# Rudderstack Integrations URL, optional. Only valid if you pass the SDK version 1.1 or higher
rudderstack_integrations_url =
# Intercom secret, optional, used to hash user_id before passing to Intercom via Rudderstack
intercom_secret =

View File

@ -286,6 +286,9 @@
# Rudderstack Config url, optional, used by Rudderstack SDK to fetch source config
;rudderstack_config_url =
# Rudderstack Integrations URL, optional. Only valid if you pass the SDK version 1.1 or higher
;rudderstack_integrations_url =
# Intercom secret, optional, used to hash user_id before passing to Intercom via Rudderstack
;intercom_secret =

View File

@ -575,6 +575,12 @@ URL to load the Rudderstack SDK.
Optional. If tracking with Rudderstack is enabled, you can provide a custom
URL to load the Rudderstack config.
### rudderstack_integrations_url
Optional. If tracking with Rudderstack is enabled, you can provide a custom
URL to load the SDK for destinations running in device mode. This setting is only valid for
Rudderstack version 1.1 and higher.
### application_insights_connection_string
If you want to track Grafana usage via Azure Application Insights, then specify _your_ Application Insights connection string. Since the connection string contains semicolons, you need to wrap it in backticks (`). By default, tracking usage is disabled.

View File

@ -219,6 +219,7 @@ export interface GrafanaConfig {
rudderstackDataPlaneUrl: string | undefined;
rudderstackSdkUrl: string | undefined;
rudderstackConfigUrl: string | undefined;
rudderstackIntegrationsUrl: string | undefined;
sqlConnectionLimits: SqlConnectionLimits;
}

View File

@ -150,6 +150,7 @@ export class GrafanaBootConfig implements GrafanaConfig {
rudderstackDataPlaneUrl: undefined;
rudderstackSdkUrl: undefined;
rudderstackConfigUrl: undefined;
rudderstackIntegrationsUrl: undefined;
sqlConnectionLimits = {
maxOpenConns: 100,
maxIdleConns: 100,

View File

@ -156,10 +156,11 @@ type FrontendSettingsDTO struct {
GoogleAnalytics4Id string `json:"googleAnalytics4Id"`
GoogleAnalytics4SendManualPageViews bool `json:"GoogleAnalytics4SendManualPageViews"`
RudderstackWriteKey string `json:"rudderstackWriteKey"`
RudderstackDataPlaneUrl string `json:"rudderstackDataPlaneUrl"`
RudderstackSdkUrl string `json:"rudderstackSdkUrl"`
RudderstackConfigUrl string `json:"rudderstackConfigUrl"`
RudderstackWriteKey string `json:"rudderstackWriteKey"`
RudderstackDataPlaneUrl string `json:"rudderstackDataPlaneUrl"`
RudderstackSdkUrl string `json:"rudderstackSdkUrl"`
RudderstackConfigUrl string `json:"rudderstackConfigUrl"`
RudderstackIntegrationsUrl string `json:"rudderstackIntegrationsUrl"`
FeedbackLinksEnabled bool `json:"feedbackLinksEnabled"`
ApplicationInsightsConnectionString string `json:"applicationInsightsConnectionString"`

View File

@ -136,6 +136,7 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro
RudderstackDataPlaneUrl: hs.Cfg.RudderstackDataPlaneURL,
RudderstackSdkUrl: hs.Cfg.RudderstackSDKURL,
RudderstackConfigUrl: hs.Cfg.RudderstackConfigURL,
RudderstackIntegrationsUrl: hs.Cfg.RudderstackIntegrationsURL,
FeedbackLinksEnabled: hs.Cfg.FeedbackLinksEnabled,
ApplicationInsightsConnectionString: hs.Cfg.ApplicationInsightsConnectionString,
ApplicationInsightsEndpointUrl: hs.Cfg.ApplicationInsightsEndpointUrl,

View File

@ -432,6 +432,7 @@ type Cfg struct {
RudderstackWriteKey string
RudderstackSDKURL string
RudderstackConfigURL string
RudderstackIntegrationsURL string
IntercomSecret string
// AzureAD
@ -1113,6 +1114,7 @@ func (cfg *Cfg) Load(args CommandLineArgs) error {
cfg.RudderstackDataPlaneURL = analytics.Key("rudderstack_data_plane_url").String()
cfg.RudderstackSDKURL = analytics.Key("rudderstack_sdk_url").String()
cfg.RudderstackConfigURL = analytics.Key("rudderstack_config_url").String()
cfg.RudderstackIntegrationsURL = analytics.Key("rudderstack_integrations_url").String()
cfg.IntercomSecret = analytics.Key("intercom_secret").String()
cfg.ReportingEnabled = analytics.Key("reporting_enabled").MustBool(true)

View File

@ -325,6 +325,7 @@ function initEchoSrv() {
user: config.bootData.user,
sdkUrl: config.rudderstackSdkUrl,
configUrl: config.rudderstackConfigUrl,
integrationsUrl: config.rudderstackIntegrationsUrl,
buildInfo: config.buildInfo,
})
);

View File

@ -34,6 +34,7 @@ export interface RudderstackBackendOptions {
user?: CurrentUserDTO;
sdkUrl?: string;
configUrl?: string;
integrationsUrl?: string;
}
export class RudderstackBackend implements EchoBackend<PageviewEchoEvent, RudderstackBackendOptions> {
@ -68,7 +69,10 @@ export class RudderstackBackend implements EchoBackend<PageviewEchoEvent, Rudder
})(method);
}
window.rudderanalytics?.load?.(options.writeKey, options.dataPlaneUrl, { configUrl: options.configUrl });
window.rudderanalytics?.load?.(options.writeKey, options.dataPlaneUrl, {
configUrl: options.configUrl,
destSDKBaseURL: options.integrationsUrl,
});
if (options.user) {
const { identifier, intercomIdentifier } = options.user.analytics;