Skip to content

Commit c0455e1

Browse files
authored
feat(dapp): add Amplitude Session Replay (#1105)
* add Amplitude Session Replay * update privacy policy * set samplerate to 100% of sessions * merge * add obfuscation
1 parent c44248d commit c0455e1

File tree

5 files changed

+265
-28
lines changed

5 files changed

+265
-28
lines changed

dapp/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@amplitude/analytics-core": "^2.34.1",
2727
"@amplitude/analytics-types": "^2.11.0",
2828
"@amplitude/engagement-browser": "^1.0.6",
29+
"@amplitude/plugin-session-replay-browser": "^1.25.10",
2930
"@growthbook/growthbook": "^1.6.1",
3031
"@growthbook/growthbook-react": "^1.6.1",
3132
"@iota/apps-ui-icons": "^0.7.0",

dapp/src/components/buttons/ConnectButton.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ import { ampli } from '@/lib/utils/analytics/ampli';
99

1010
export function ConnectButton() {
1111
return (
12-
<DappConnectButton
13-
connectText="Connect"
14-
onConnected={(args) => {
15-
ampli.connectedWallet({ wallet: args.wallet.name });
16-
}}
17-
/>
12+
<div className="amp-obfuscation">
13+
<DappConnectButton
14+
connectText="Connect"
15+
onConnected={(args) => {
16+
ampli.connectedWallet({ wallet: args.wallet.name });
17+
}}
18+
/>
19+
</div>
1820
);
1921
}

dapp/src/legal/privacyPolicy.mdx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,17 @@ For more details on how Amplitude processes personal data, please refer to <span
6464

6565
If you access or interact with the IOTA Names Service directly through the blockchain without using the Website interface, no cookies are set, and no analytics data is collected.
6666

67-
### **3.5 Error and Performance Monitoring (Sentry)**
67+
### **3.5 Session Replay (Amplitude)**
68+
69+
With your consent, we use Amplitude’s Session Replay technology to understand how users interact with the Website and to improve its usability and stability. Session Replay records interaction data such as clicks, scroll behaviour, navigation patterns, and general user interface engagement. All fields that may contain personal or identifying information (such as usernames, wallet details, or free-text inputs) are masked by default in accordance with Amplitude’s privacy settings, and no passwords, payment information, or other sensitive data are collected.
70+
71+
We receive session-level recordings of user interactions; however, due to the applied masking and configuration, the data does not allow us to identify individual users. Any insights derived from these recordings are evaluated exclusively on an aggregated and statistical basis for the purposes of diagnosing usability issues, identifying technical errors, and optimising the Website.
72+
73+
The use of Session Replay is based on your consent pursuant to Article 6(1)(a) GDPR, which you may withdraw at any time via the “Cookie Settings” link on the Website. Data processed via Session Replay is retained for a maximum period of thirty (30) days before being deleted or anonymised.
74+
75+
Where data is processed outside the United Kingdom or the European Economic Area, such transfers are safeguarded through the use of the Standard Contractual Clauses together with the UK Addendum.
76+
77+
### **3.6 Error and Performance Monitoring (Sentry)**
6878

6979
We use Sentry, a monitoring service provided by Functional Software, Inc., to detect and fix technical errors and ensure the stability of the Website. In the event of an error, Sentry records limited technical information such as browser type, operating system, time of occurrence, URL path, and diagnostic details (for example, stack traces).
7080

dapp/src/lib/utils/analytics/amplitude.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import * as amplitude from '@amplitude/analytics-browser';
55
import { LogLevel } from '@amplitude/analytics-core';
66
import { plugin as engagementPlugin } from '@amplitude/engagement-browser';
7+
import { sessionReplayPlugin } from '@amplitude/plugin-session-replay-browser';
78

89
import { CONFIG } from '@/config';
910

@@ -70,6 +71,19 @@ export async function initAmplitude() {
7071
// Add context enrichment plugin to add page context to all events
7172
if (IS_ENABLED) {
7273
ampli.client.add(contextEnrichmentPlugin());
74+
const sessionReplayTracking = sessionReplayPlugin({
75+
sampleRate: 1, // set to 1 to capture all sessions; adjust as needed (e.g., 0.1 for 10%)
76+
privacyConfig: {
77+
defaultMaskLevel: 'medium',
78+
maskSelector: [
79+
'.amp-obfuscation', // any element with this class will be masked according to the defaultMaskLevel
80+
// specific selectors for the dropdown menu (comes from @iota/dapp-kit) to ensure it's fully masked
81+
'[data-radix-popper-content-wrapper]',
82+
'[class*="AccountDropdownMenu"]',
83+
],
84+
},
85+
});
86+
ampli.client.add(sessionReplayTracking);
7387
}
7488

7589
setNetworkGroup(defaultNetwork);

0 commit comments

Comments
 (0)