How to allow Ahrefs Analytics access to my Nuxt site

I’m trying to add Ahrefs Analytics service to some of my websites hosted on Netlify and built with Nuxt.

Specifically, we can take https://links.stefanobartoletti.it/ as an example.

I’ve correctly added the script to my website head, like this

<script src="https://analytics.ahrefs.com/analytics.js" data-key="xxxxxxxxxxxxxxxxxxxxx" async></script>

But it is not detected, and after contacting Ahrefs support, they told me that their bot is receiving a different response and that it cannot see it:

Our team mentioned your webserver is answering something different to our bot:

To get verification working you should also have the <script … tag when responding to our bot.

Bot User-agent containing: 'AhrefsSiteAudit and +http://ahrefs.com/robot/site-audit

Basically - the webserver is answering different HTML for our bot (and likely other robots)

The discrimination is based on the User-agent header

How can I allow this specific bot to receive the correct data it needs (without allowing all other bots, of course)?

I initially thought that this could be related to robots.txt, but I can see that the HTML served to that crawler is different from the default one.

How can I allow this bot access to my site?


You’ve enabled prerendering: Build & deploy | Site configuration | stefanobartoletti-links | Netlify. You can disable that.