Small programming project (closed)

Hello! I have a very small programming project that needs a developer. Here are the basics:

  • Grab the URL of the current page.
  • Cut out the domain part of the URL, then put the remainder into a custom URL (which I have figured out) and send it to the analytics service we use.
  • Take the resulting XML snippet which will contain the number of views for that page over the past year, and pull out only the number.
  • Put that number into something that can be displayed on the page with the word “Views:”.

I’ve already gotten the query URL figured out; when I put it into the address bar of a browser and hit Enter, it returns this XML, with the correct number of page views for the URL I sent:

<response status="ok">
  <type type="pages">
    <date date="2021-10-22,2022-10-21">

Now I need someone to figure out how to automate the process and display the result on each page on the site.

If interested, message me with your info.

OR, if you immediately see how to do this and want to save me money, post the answer below. :wink:


As long as it’s OK for all site visitors to hit this URL (no bandwidth limits, no API keys you can’t expose), and this URL doesn’t have annoying CORS settings that’ll mess up a browser request, you could just add a little bit of javascript that just grabs the value from the url when the user visits the page. You’ll get live hit counts, but the analytics service may not like it.

If you want those values stored within Ghost, that’s a slightly bigger project.

The site credentials are hashed by the analytics provider (and the hash is shown to me), so no one can use them to log in. So, no worries there.

And no, I don’t want them stored anywhere. They’re already stored with the analytics provider (Clicky) day by day, so I can get them whenever I want. This is to put a views count on each post so viewers can see for themselves how much interest there is in a story.

It’s by no means a must-have, but having gotten as far as having the correct GET URL return the right view count for the test page, I just feel very close – but don’t have time to figure it out myself.