Skip to content

Commit f34a089

Browse files
authored
Exclude internal projects & tests from analytics (#1199)
* Exclude internal projects & tests from analytics * Exclude also Codespaces * Fix typo * Update analytics.js * Use identifiers instead of raw values
1 parent d406a2a commit f34a089

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/analytics.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const {
2121
GITHUB_SERVER_URL,
2222
GITHUB_REPOSITORY_OWNER,
2323
GITHUB_ACTOR,
24+
GITHUB_REPOSITORY,
2425
CI_SERVER_URL,
2526
CI_PROJECT_ROOT_NAMESPACE,
2627
GITLAB_USER_NAME,
@@ -72,7 +73,7 @@ const groupId = async () => {
7273
} else if (ci === 'gitlab') {
7374
rawId = `${CI_SERVER_URL}/${CI_PROJECT_ROOT_NAMESPACE}`;
7475
} else if (ci === 'bitbucket') {
75-
rawId = BITBUCKET_WORKSPACE;
76+
rawId = `https://bitbucket.com/${BITBUCKET_WORKSPACE}`;
7677
}
7778

7879
return await deterministic(rawId);
@@ -186,6 +187,22 @@ const send = async ({
186187
if (ITERATIVE_DO_NOT_TRACK) return;
187188
if (!event.user_id || event.user_id === ID_DO_NOT_TRACK) return;
188189

190+
// Exclude runs from GitHub Codespaces at Iterative
191+
if (GITHUB_REPOSITORY.startsWith('iterative/')) return;
192+
193+
// Exclude continuous integration tests and internal projects from analytics
194+
if (
195+
[
196+
'dc16cd76-71b7-5afa-bf11-e85e02ee1554', // deterministic("https://github.com/iterative")
197+
'b0e229bf-2598-54b7-a3e0-81869cdad579', // deterministic("https://github.com/iterative-test")
198+
'd5aaeca4-fe6a-5c72-8aa7-6dcd65974973', // deterministic("https://gitlab.com/iterative.ai")
199+
'b6df227b-5b3d-5190-a8fa-d272b617ee6c', // deterministic("https://gitlab.com/iterative-test")
200+
'2c6415f0-cb5a-5e52-8c81-c5af4f11715d', // deterministic("https://bitbucket.com/iterative-ai")
201+
'c0b86b90-d63c-5fb0-b84d-718d8e15f8d6' // deterministic("https://bitbucket.com/iterative-test")
202+
].includes(event.group_id)
203+
)
204+
return;
205+
189206
const controller = new AbortController();
190207
const id = setTimeout(() => controller.abort(), 5 * 1000);
191208
await fetch(endpoint, {

0 commit comments

Comments
 (0)