You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/analytics/cloud.mdx
+34-1Lines changed: 34 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ To enable Sourcegraph Analytics:
15
15
16
16
## Data export
17
17
18
-
Sourcegraph Cloud Analytics also includes a CSV export option with key metrics like the number of searches, chats, autocomplete suggestions, completion acceptance rate (CAR %), and more. The data is split by user, day, client/editor, and programming language, perfect for automating retrieval and analyzing data in ways that make the most sense to your organization.
18
+
Sourcegraph Analytics also includes a CSV export option with key metrics like the number of searches, chats, autocomplete suggestions, completion acceptance rate (CAR %), and more. The data is split by user, day, client/editor, and programming language, perfect for automating retrieval and analyzing data in ways that make the most sense to your organization.
> NOTE: There is no output from the revocation request. To verify that the token has been revoked, list the tokens and verify `isExpired` is `true`.
115
+
116
+
## API Reference
117
+
118
+
Sourcegraph Analytics API is a RESTful API that allows access to Sourcegraph Analytics data. For authenticating to the API follow the [token creation](#token-creation) instructions.
119
+
120
+
Exportyouraccesstokenasenenvironmentvariable:
121
+
```sh
122
+
export ACCESS_TOKEN="<ACCESS_TOKEN>"
123
+
```
124
+
125
+
### CSV Export
126
+
127
+
To generate a CSV export of the data for a specific instance, run the following commands:
128
+
```sh
129
+
export INSTANCE_URL="<INSTANCE URL>"# e.g. example.sourcegraphcloud.com
130
+
131
+
curl -X GET "https://analytics.sourcegraph.com/api/reports/by-user-client-date?instanceURL=$INSTANCE_URL" \
132
+
-H "Authorization: Bearer $ACCESS_TOKEN"
133
+
```
134
+
135
+
Optional granularity values can be specified. If not specified the default is `by_user_day_client_language`.
136
+
-`by_user`,
137
+
-`by_user_month`,
138
+
-`by_user_day`,
139
+
-`by_user_day_client_language`
140
+
141
+
```sh
142
+
export INSTANCE_URL="<INSTANCE_URL>"# e.g. example.sourcegraphcloud.com
143
+
export GRANULARITY="<GRANULARITY>"
144
+
145
+
curl -X GET "https://analytics.sourcegraph.com/api/reports/by-user-client-date?instanceURL=$INSTANCE_URL&granularity=$GRANULARITY" \
0 commit comments