Browse Source

add hotjar analytics

Klaudiusz Dembler 4 năm trước cách đây
mục cha
commit
b89fde8e6a

+ 15 - 0
public/index.html

@@ -12,6 +12,21 @@
       rel="stylesheet"
       href="https://eu-central-1.linodeobjects.com/atlas-assets/fonts/Optimo-PxGrotesk/PxGroteskBold-Regular.css"
     />
+    <script>
+      ;(function (h, o, t, j, a, r) {
+        h.hj =
+          h.hj ||
+          function () {
+            ;(h.hj.q = h.hj.q || []).push(arguments)
+          }
+        h._hjSettings = { hjid: 2060005, hjsv: 6 }
+        a = o.getElementsByTagName('head')[0]
+        r = o.createElement('script')
+        r.async = 1
+        r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv
+        a.appendChild(r)
+      })(window, document, 'https://static.hotjar.com/c/hotjar-', '.js?sv=')
+    </script>
     <title>Atlas</title>
   </head>
   <body>

+ 5 - 0
src/mocking/server/index.ts

@@ -51,6 +51,11 @@ createServer({
 
     this.post(ORION_GRAPHQL_URL, orionHandler, { timing: MOCKED_SERVER_LOAD_DELAY })
     // this.passthrough(ORION_GRAPHQL_URL)
+
+    // allow Hotjar analytics requests
+    this.passthrough((request) => {
+      return request.url.includes('hotjar')
+    })
   },
 
   seeds(server) {

+ 1 - 0
src/shared/components/Searchbar/Searchbar.tsx

@@ -50,6 +50,7 @@ const Searchbar: React.FC<SearchbarProps> = ({
         onFocusCapture={onFocus}
         onBlur={onBlur}
         onSubmit={onSubmit}
+        data-hj-allow
         {...htmlProps}
       />
       {showCancelButton && <CancelButton onClick={handleCancel} variant="tertiary" icon="times" size="smaller" />}