Post to insights.algolia.io has status pending

POST to https://insights.algolia.io/1/events has status (pending)

Should the Contnet-Type be application/json?
If so, how is it set?

!(function(e, a, t, n, s, i, c) {
        (e.AlgoliaAnalyticsObject = s),
          (e.aa =
            e.aa ||
            function() {
              (e.aa.queue = e.aa.queue || []).push(arguments);
            }),
          (i = a.createElement(t)),
          (c = a.getElementsByTagName(t)[0]),
          (i.async = 1),
          (i.src = "https://cdn.jsdelivr.net/npm/search-insights@1.0.0"),
          c.parentNode.insertBefore(i, c);
      })(window, document, "script", 0, "aa");

      // Initialize Insights library
      aa("init", {
        appId: "XXXXXXXXX",
        apiKey: "ZZZZZZZZZ"
      });


      // To send a click event
      aa("clickedObjectIDsAfterSearch", {
        eventName: "product_clicked",
        index: algoliaIndex,
        queryID: suggestion._queryID,
        objectIDs: [suggestion.objectID],
        positions: [suggestion._position]
      });

SOLVED
I moved some js code to the head of the page and it started working correctly

Hi @ajmercer. Glad you figured this out. Do not hesitate to share your code with us if you think it can help someone else.