feat(editor, core): Integrate PostHog (#3865)

* Integrate PostHog - Part 1: Groundwork (#3753)

* Integrate PostHog - Part 2: Event capture (#3779)

* Integrate PostHog - Part 3: Session recordings (#3789)

* Integrate PostHog - Part 4: Experiments (#3825)

* Finalize PostHog integration (#3866)

* 📦 Update `package-lock.json`

* 🐛 Account for absent PH hooks file

*  Create new env `EXTERNAL_FRONTEND_HOOKS_FILES`

*  Adjust env used for injecting PostHog

* 🐛 Switch to semicolon delimiter

*  Simplify to `externalFrontendHookPath`

* Refactor FE hooks flow (#3884)

* Add env var for session recordings

* inject frontend hooks even when telemetry is off

* allow multiple hooks files

* cr

* 🐛 Handle missing ref errors

* 🔥 Remove outdated `continue`

* 🎨 Change one-liners to blocks

* 📦 Update `package-lock.json`

Co-authored-by: Ahsan Virani <ahsan.virani@gmail.com>
This commit is contained in:
Iván Ovejero
2022-08-19 15:35:39 +02:00
committed by GitHub
parent 2b4f5c6c78
commit 43e054f5ab
37 changed files with 676 additions and 217 deletions

View File

@@ -488,6 +488,18 @@ export default mixins(
}
}
},
updated() {
this.$nextTick(() => {
const jsonValues = this.$el.querySelectorAll('.vjs-value');
const tableRows = this.$el.querySelectorAll('tbody tr');
const elements = [...jsonValues, ...tableRows].reduce<Element[]>((acc, cur) => [...acc, cur], []);
if (elements.length > 0) {
this.$externalHooks().run('runData.updated', { elements });
}
});
},
destroyed() {
this.hidePinDataDiscoveryTooltip();
this.eventBus.$off('data-pinning-error', this.onDataPinningError);
@@ -802,14 +814,16 @@ export default mixins(
});
},
onDataPinningSuccess({ source }: { source: 'pin-icon-click' | 'save-edit' }) {
this.$telemetry.track('Ndv data pinning success', {
const telemetryPayload = {
pinning_source: source,
node_type: this.activeNode.type,
session_id: this.sessionId,
data_size: stringSizeInBytes(this.pinData),
view: this.displayMode,
run_index: this.runIndex,
});
};
this.$externalHooks().run('runData.onDataPinningSuccess', telemetryPayload);
this.$telemetry.track('Ndv data pinning success', telemetryPayload);
},
onDataPinningError(
{ errorType, source }: {
@@ -831,12 +845,15 @@ export default mixins(
{ source }: { source: 'banner-link' | 'pin-icon-click' | 'unpin-and-execute-modal' },
) {
if (source === 'pin-icon-click') {
this.$telemetry.track('User clicked pin data icon', {
const telemetryPayload = {
node_type: this.activeNode.type,
session_id: this.sessionId,
run_index: this.runIndex,
view: !this.hasNodeRun && !this.hasPinData ? 'none' : this.displayMode,
});
};
this.$externalHooks().run('runData.onTogglePinData', telemetryPayload);
this.$telemetry.track('User clicked pin data icon', telemetryPayload);
}
this.updateNodeParameterIssues(this.node);