forked from NomicFoundation/hardhat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request NomicFoundation#4709 from NomicFoundation/analytic…
…s-track-telemetry-response Report telemetry consent response to Google Analytics
- Loading branch information
Showing
5 changed files
with
111 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"hardhat": patch | ||
--- | ||
|
||
Report telemetry consent response to Google Analytics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/hardhat-core/src/internal/util/report-telemetry-consent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Analytics } from "../cli/analytics"; | ||
|
||
async function main() { | ||
const [telemetryConsent] = process.argv.slice(2); | ||
|
||
// we pass undefined as the telemetryConsent value because | ||
// this hit is done before the consent is saved | ||
const analytics = await Analytics.getInstance(undefined); | ||
|
||
const [_, consentHitPromise] = await analytics.sendTelemetryConsentHit( | ||
telemetryConsent as "yes" | "no" | ||
); | ||
await consentHitPromise; | ||
} | ||
|
||
main().catch(() => {}); |