mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Analytics: Use Fullstory to get behavioral data (#53732)
This commit is contained in:
@@ -215,6 +215,9 @@ google_analytics_ua_id =
|
|||||||
# Google Tag Manager ID, only enabled if you specify an id here
|
# Google Tag Manager ID, only enabled if you specify an id here
|
||||||
google_tag_manager_id =
|
google_tag_manager_id =
|
||||||
|
|
||||||
|
# Fullstory org id, only enabled if you specify an org id here
|
||||||
|
fullstory_org_id =
|
||||||
|
|
||||||
# Rudderstack write key, enabled only if rudderstack_data_plane_url is also set
|
# Rudderstack write key, enabled only if rudderstack_data_plane_url is also set
|
||||||
rudderstack_write_key =
|
rudderstack_write_key =
|
||||||
|
|
||||||
|
|||||||
@@ -250,6 +250,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/css": "11.9.0",
|
"@emotion/css": "11.9.0",
|
||||||
"@emotion/react": "11.9.3",
|
"@emotion/react": "11.9.3",
|
||||||
|
"@fullstory/browser": "^1.6.1",
|
||||||
"@grafana/agent-core": "0.4.0",
|
"@grafana/agent-core": "0.4.0",
|
||||||
"@grafana/agent-web": "0.4.0",
|
"@grafana/agent-web": "0.4.0",
|
||||||
"@grafana/aws-sdk": "0.0.37",
|
"@grafana/aws-sdk": "0.0.37",
|
||||||
|
|||||||
@@ -211,6 +211,7 @@ export interface GrafanaConfig {
|
|||||||
feedbackLinksEnabled: boolean;
|
feedbackLinksEnabled: boolean;
|
||||||
secretsManagerPluginEnabled: boolean;
|
secretsManagerPluginEnabled: boolean;
|
||||||
googleAnalyticsId: string | undefined;
|
googleAnalyticsId: string | undefined;
|
||||||
|
fullstoryOrgId: string | undefined;
|
||||||
rudderstackWriteKey: string | undefined;
|
rudderstackWriteKey: string | undefined;
|
||||||
rudderstackDataPlaneUrl: string | undefined;
|
rudderstackDataPlaneUrl: string | undefined;
|
||||||
rudderstackSdkUrl: string | undefined;
|
rudderstackSdkUrl: string | undefined;
|
||||||
|
|||||||
@@ -63,4 +63,5 @@ export interface FeatureToggles {
|
|||||||
internationalization?: boolean;
|
internationalization?: boolean;
|
||||||
topnav?: boolean;
|
topnav?: boolean;
|
||||||
customBranding?: boolean;
|
customBranding?: boolean;
|
||||||
|
fullstoryUserTracking?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ export class GrafanaBootConfig implements GrafanaConfig {
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
};
|
};
|
||||||
googleAnalyticsId: undefined;
|
googleAnalyticsId: undefined;
|
||||||
|
fullstoryOrgId: undefined;
|
||||||
rudderstackWriteKey: undefined;
|
rudderstackWriteKey: undefined;
|
||||||
rudderstackDataPlaneUrl: undefined;
|
rudderstackDataPlaneUrl: undefined;
|
||||||
rudderstackSdkUrl: undefined;
|
rudderstackSdkUrl: undefined;
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ export enum EchoEventType {
|
|||||||
Interaction = 'interaction',
|
Interaction = 'interaction',
|
||||||
ExperimentView = 'experimentview',
|
ExperimentView = 'experimentview',
|
||||||
GrafanaJavascriptAgent = 'grafana-javascript-agent',
|
GrafanaJavascriptAgent = 'grafana-javascript-agent',
|
||||||
|
Fullstory = 'fullstory-sdk',
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -107,6 +107,13 @@ export interface InteractionEchoEventPayload {
|
|||||||
*/
|
*/
|
||||||
export type InteractionEchoEvent = EchoEvent<EchoEventType.Interaction, InteractionEchoEventPayload>;
|
export type InteractionEchoEvent = EchoEvent<EchoEventType.Interaction, InteractionEchoEventPayload>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes Fullstory custom interaction event with predefined {@link EchoEventType.EchoEventType} type.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export type FullstoryEchoEvent = EchoEvent<EchoEventType.Fullstory, InteractionEchoEventPayload>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes the payload of an experimentview event.
|
* Describes the payload of an experimentview event.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *models.ReqContext) (map[string]i
|
|||||||
"profileEnabled": setting.ProfileEnabled,
|
"profileEnabled": setting.ProfileEnabled,
|
||||||
"queryHistoryEnabled": hs.Cfg.QueryHistoryEnabled,
|
"queryHistoryEnabled": hs.Cfg.QueryHistoryEnabled,
|
||||||
"googleAnalyticsId": setting.GoogleAnalyticsId,
|
"googleAnalyticsId": setting.GoogleAnalyticsId,
|
||||||
|
"fullstoryOrgId": setting.FullstoryOrgId,
|
||||||
"rudderstackWriteKey": setting.RudderstackWriteKey,
|
"rudderstackWriteKey": setting.RudderstackWriteKey,
|
||||||
"rudderstackDataPlaneUrl": setting.RudderstackDataPlaneUrl,
|
"rudderstackDataPlaneUrl": setting.RudderstackDataPlaneUrl,
|
||||||
"rudderstackSdkUrl": setting.RudderstackSdkUrl,
|
"rudderstackSdkUrl": setting.RudderstackSdkUrl,
|
||||||
|
|||||||
@@ -262,5 +262,9 @@ var (
|
|||||||
Description: "Replaces whitelabeling with the new custom branding feature",
|
Description: "Replaces whitelabeling with the new custom branding feature",
|
||||||
State: FeatureStateAlpha,
|
State: FeatureStateAlpha,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "fullstoryUserTracking",
|
||||||
|
Description: "Enables Fullstory cliend SDK to do user analytics",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -194,4 +194,8 @@ const (
|
|||||||
// FlagCustomBranding
|
// FlagCustomBranding
|
||||||
// Replaces whitelabeling with the new custom branding feature
|
// Replaces whitelabeling with the new custom branding feature
|
||||||
FlagCustomBranding = "customBranding"
|
FlagCustomBranding = "customBranding"
|
||||||
|
|
||||||
|
// FlagFullstoryUserTracking
|
||||||
|
// Enables Fullstory cliend SDK to do user analytics
|
||||||
|
FlagFullstoryUserTracking = "fullstoryUserTracking"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ var (
|
|||||||
// analytics
|
// analytics
|
||||||
GoogleAnalyticsId string
|
GoogleAnalyticsId string
|
||||||
GoogleTagManagerId string
|
GoogleTagManagerId string
|
||||||
|
FullstoryOrgId string
|
||||||
RudderstackDataPlaneUrl string
|
RudderstackDataPlaneUrl string
|
||||||
RudderstackWriteKey string
|
RudderstackWriteKey string
|
||||||
RudderstackSdkUrl string
|
RudderstackSdkUrl string
|
||||||
@@ -953,6 +954,7 @@ func (cfg *Cfg) Load(args CommandLineArgs) error {
|
|||||||
cfg.CheckForPluginUpdates = analytics.Key("check_for_plugin_updates").MustBool(true)
|
cfg.CheckForPluginUpdates = analytics.Key("check_for_plugin_updates").MustBool(true)
|
||||||
GoogleAnalyticsId = analytics.Key("google_analytics_ua_id").String()
|
GoogleAnalyticsId = analytics.Key("google_analytics_ua_id").String()
|
||||||
GoogleTagManagerId = analytics.Key("google_tag_manager_id").String()
|
GoogleTagManagerId = analytics.Key("google_tag_manager_id").String()
|
||||||
|
FullstoryOrgId = analytics.Key("fullstory_org_id").String()
|
||||||
RudderstackWriteKey = analytics.Key("rudderstack_write_key").String()
|
RudderstackWriteKey = analytics.Key("rudderstack_write_key").String()
|
||||||
RudderstackDataPlaneUrl = analytics.Key("rudderstack_data_plane_url").String()
|
RudderstackDataPlaneUrl = analytics.Key("rudderstack_data_plane_url").String()
|
||||||
RudderstackSdkUrl = analytics.Key("rudderstack_sdk_url").String()
|
RudderstackSdkUrl = analytics.Key("rudderstack_sdk_url").String()
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ import { Echo } from './core/services/echo/Echo';
|
|||||||
import { reportPerformance } from './core/services/echo/EchoSrv';
|
import { reportPerformance } from './core/services/echo/EchoSrv';
|
||||||
import { PerformanceBackend } from './core/services/echo/backends/PerformanceBackend';
|
import { PerformanceBackend } from './core/services/echo/backends/PerformanceBackend';
|
||||||
import { ApplicationInsightsBackend } from './core/services/echo/backends/analytics/ApplicationInsightsBackend';
|
import { ApplicationInsightsBackend } from './core/services/echo/backends/analytics/ApplicationInsightsBackend';
|
||||||
|
import { FullstoryBackend } from './core/services/echo/backends/analytics/FullstoryBackend';
|
||||||
import { GAEchoBackend } from './core/services/echo/backends/analytics/GABackend';
|
import { GAEchoBackend } from './core/services/echo/backends/analytics/GABackend';
|
||||||
import { RudderstackBackend } from './core/services/echo/backends/analytics/RudderstackBackend';
|
import { RudderstackBackend } from './core/services/echo/backends/analytics/RudderstackBackend';
|
||||||
import { GrafanaJavascriptAgentBackend } from './core/services/echo/backends/grafana-javascript-agent/GrafanaJavascriptAgentBackend';
|
import { GrafanaJavascriptAgentBackend } from './core/services/echo/backends/grafana-javascript-agent/GrafanaJavascriptAgentBackend';
|
||||||
@@ -206,6 +207,12 @@ function initEchoSrv() {
|
|||||||
registerEchoBackend(new PerformanceBackend({}));
|
registerEchoBackend(new PerformanceBackend({}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.featureToggles.fullstoryUserTracking && config.fullstoryOrgId) {
|
||||||
|
registerEchoBackend(
|
||||||
|
new FullstoryBackend({ orgId: config.fullstoryOrgId, devMode: process.env.NODE_ENV === 'development' })
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (config.sentry.enabled) {
|
if (config.sentry.enabled) {
|
||||||
registerEchoBackend(
|
registerEchoBackend(
|
||||||
new SentryEchoBackend({
|
new SentryEchoBackend({
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { init } from '@fullstory/browser';
|
||||||
|
|
||||||
|
import { EchoBackend, EchoEventType, FullstoryEchoEvent } from '@grafana/runtime';
|
||||||
|
|
||||||
|
export interface FullstoryBackendOptions {
|
||||||
|
orgId: string;
|
||||||
|
devMode?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class FullstoryBackend implements EchoBackend<FullstoryEchoEvent, FullstoryBackendOptions> {
|
||||||
|
supportedEvents = [EchoEventType.Fullstory];
|
||||||
|
|
||||||
|
constructor(public options: FullstoryBackendOptions) {
|
||||||
|
init({ orgId: options.orgId, devMode: options.devMode ?? false, debug: options.devMode ?? false });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not using custom events, Fullstory track every interaction automatically
|
||||||
|
addEvent = (e: FullstoryEchoEvent) => {};
|
||||||
|
|
||||||
|
// Not using Echo buffering
|
||||||
|
flush = () => {};
|
||||||
|
}
|
||||||
@@ -4719,6 +4719,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@fullstory/browser@npm:^1.6.1":
|
||||||
|
version: 1.6.1
|
||||||
|
resolution: "@fullstory/browser@npm:1.6.1"
|
||||||
|
checksum: 79bb1c05b92b6bb6163566eeceb2ddf8e7e7bf5b9d629d99a937cecc21eafc019a0149c78d968e623424cbc84e9ce10e162e8ab56e59d47d259ca8e364f5c249
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@gar/promisify@npm:^1.0.1":
|
"@gar/promisify@npm:^1.0.1":
|
||||||
version: 1.1.2
|
version: 1.1.2
|
||||||
resolution: "@gar/promisify@npm:1.1.2"
|
resolution: "@gar/promisify@npm:1.1.2"
|
||||||
@@ -21642,6 +21649,7 @@ __metadata:
|
|||||||
"@emotion/css": 11.9.0
|
"@emotion/css": 11.9.0
|
||||||
"@emotion/eslint-plugin": 11.7.0
|
"@emotion/eslint-plugin": 11.7.0
|
||||||
"@emotion/react": 11.9.3
|
"@emotion/react": 11.9.3
|
||||||
|
"@fullstory/browser": ^1.6.1
|
||||||
"@grafana/agent-core": 0.4.0
|
"@grafana/agent-core": 0.4.0
|
||||||
"@grafana/agent-web": 0.4.0
|
"@grafana/agent-web": 0.4.0
|
||||||
"@grafana/api-documenter": 7.11.2
|
"@grafana/api-documenter": 7.11.2
|
||||||
|
|||||||
Reference in New Issue
Block a user