Swiftype Clickthrough Tracking for Analytics

We are using the crawler based option and am trying to determine how to track clicks on individual search results. I found the following two options:

I am assuming that we should be using the first link. However, the API endpoint listed in the first link, "https://api.swiftype.com/api/v1/public/analytics/pc.json", does not seem to be responsive. I do not get an error in the console and under Network > Timing it simply lists "Stalled". Pasting the url in the browser brings up a generic error that "The page isn't working".

I tried logging a page click using curl rather than Javascript GET request (Axios) and the curl request was successful in showing up in our Analytics dashboard the following day for the page I clicked.

I also tried using the reference in this post, laravel - Send object with axios get request - Stack Overflow, and it did not work either.

I tried using a curl to fetch converter, using the following:

fetch('https://api.swiftype.com/api/v1/public/analytics/pc.json', {   
    method: 'POST',
    headers: {
    'Content-Type': 'application/json'
    },
    body: JSON.stringify({ "engine_key": "our_engine_key", "doc_id": "60127004e7b9d2627bb0930f", "q": "engineering" })
    });

Unfortunately, this did not work either.

Looking for clarification on this issue.

Thanks, in advance.

Hi @sleblang,

Can you "copy as cURL" the request from the network tab of your dev tools, and compare with the curl command you used that worked? Perhaps your javascript approach had a typo in the endpoint or payload?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.