That is a great question. Although, I am not able to give you the advice for the coding I can refer you over to the Shopify Experts who are very knowledgable in the field of coding. By the sounds of it, it seems like something that they could get done for you.
Is there a particular reason why you are not wanting to have a third party app? The reason that I say this is that I found an app that would work for this and it has a free plan available. It is called Hit Counter. It is used to mark the hits on any page that you connect it to.
If you would still prefer to not use an app then I would suggest you reach out to the Shopify Experts.
If you have any more questions please do let me know.