Is it possible to use Microsoft Clarity in Electron App? Getting 400 Bad request

395 Views Asked by At

I am trying to use Microsft-Clarity https://clarity.microsoft.com/ in my Electron App. I have added their integration steps in Head section of my app's main page. On running the app, in network section it is shoiwng network call to https://d/clarity.ms/collect but it is giving 400 bad request error in the response.

I am using Electron version 13.x

Is it possible to use Clarity in Electron app or not? Or do I need to make any specific changes to support it?

I have added the following code in head section of page

<script type="text/javascript">
    (function(c,l,a,r,i,t,y){
        c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
        t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
        y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
    })(window, document, "clarity", "script", "<Project_id>");
</script>

POST request is being made for the following URL:

https://d/clarity.ms/collect

Request header has following value

authority: d.clarity.ms
method: POST
path: /collect
scheme: https
accept: application/x-clarity-gzip
accept-encoding: gzip, deflate, br
accept-language: en-US
content-length: 285595
cookie: MUID=XXXXXXXXXXXXXXXXXXXXX
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: cross-site
user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) XXXXXX/XXXXX Chrome/91.0.4472.164 Electron/13.6.9 Safari/537.36

Getting the following response for the request

{  
     "type":"https://tools.ietf.org/html/rfc7231#section-6.5.1",
     "title":"Bad Request",
     "status":400,
     "traceId":"00-xxxxxxxxxxxxxxx-xxxxxxxxxxxx-00"
}
1

There are 1 best solutions below

0
Microsoft Clarity On

We currently do not support Electron App. Will consider this as feedback.