File tree 1 file changed +8
-0
lines changed
packages/webembeds-core/src/utils
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,12 @@ if (!HASHNODE_GRAPHQL_USER_ACCESS_TOKEN) {
10
10
throw new Error ( "HASHNODE_GRAPHQL_USER_ACCESS_TOKEN is not defined" ) ;
11
11
}
12
12
13
+ // client tracking (https://dev.stellate.co/docs/graphql-metrics/clients)
14
+ const STELLATE_CLIENT_NAME_HEADER = "x-graphql-client-name" ;
15
+ const STELLATE_CLIENT_VERSION_HEADER = "x-graphql-client-version" ;
16
+
17
+ const isServer = typeof window === "undefined" ;
18
+
13
19
/**
14
20
* Executes a GraphQL query and returns the data and errors.
15
21
*/
@@ -25,6 +31,8 @@ export const fetchGraphQL = async (options: {
25
31
headers : {
26
32
"Content-Type" : "application/json" ,
27
33
"hn-trace-app" : "Embeds" ,
34
+ [ STELLATE_CLIENT_NAME_HEADER ] : "webembeds" ,
35
+ [ STELLATE_CLIENT_VERSION_HEADER ] : isServer ? "server" : "browser" ,
28
36
Authorization : HASHNODE_GRAPHQL_USER_ACCESS_TOKEN ,
29
37
} ,
30
38
body : JSON . stringify ( {
You can’t perform that action at this time.
0 commit comments