Add the badge to Astro
Astro is the easy case: components compile to real HTML, so a plain <script> tag behaves exactly as it does in a hand-written page. The only decision is which file, and the answer is the base layout every page already wraps in.
Where the code goes
src/layouts/Layout.astro. Or whatever your base layout is called. Paste the line just before </body>, after the <slot />. One paste covers every page that uses the layout, including pages you add later.
If you have more than one layout. A blog layout and a marketing layout are common. The badge belongs in every layout you want it to appear under, or extract a single BaseHead/BaseBody component and put it there once.
The code
<slot />
<script src="https://maketaksh.com/badge.js" data-taksh="yourname" defer></script>
</body>Swap yourname for your handle. It is the one in your dashboard.
Astro's bundler processing your script
Astro processes <script> tags it considers yours: bundling them, and rewriting the src. For an external third-party script with a full URL it leaves the tag alone, which is what you want. If your build is rewriting it anyway, add is:inline to opt that tag out of processing entirely.
Checking it worked
Load the published page and look at the bottom corner. If nothing is there, it is almost always one of four things, in order of how often: the handle has no projects in it yet; the handle is wrong; the platform stripped the tag, as described above; or a content blocker ate it, check the Network tab for badge.js.
Once it is live, the Analytics panel in your dashboard lists every site the badge has been seen on, from the first page load, which is the fastest way to confirm an install on a site you cannot easily open.
Other setups
Hugo, Jekyll and Eleventy · Next.js · All twelve setups
What the badge is, and why cross-linking your own launches is worth doing at all: the short version.