WordPress has no built-in box for a line like this, so it goes in through a plugin or a template.
On WordPress.com: JavaScript needs a plan that supports plugins, with hosting features activated. Without one, this guide won’t work. Self-hosted WordPress.org sites can follow it as is.
Easiest: a footer-scripts plugin
- In your dashboard, go to Plugins → Add New and install a free “insert headers and footers” plugin (several exist under that description).
- Open the plugin’s settings and find its Footer (or “Scripts in Footer”) box.
- Paste the Snippet there.
- Save.
On a block theme, without a plugin
- Go to Appearance → Editor.
- Open your site’s footer template part (or any template that appears on every page).
- Add a Custom HTML block and paste the Snippet into it.
- Save, then update the template.
A classic (non-block) theme works the same way through footer.php in a child theme, pasted just before</body>. Do this only if you’re comfortable editing theme files.
Your line
<script async src="https://cdn.sitepets.com/v1/pet.js" data-key="sp_YOUR_SITE_KEY"></script>
If it doesn’t show up
WordPress doesn’t add a Content-Security-Policy on its own. If a security plugin (e.g. a firewall or headers plugin) added one, allow cdn.sitepets.com in script-src and img-src, and cdn.sitepets.com and b.sitepets.com in connect-src.
Once it’s live, Claim your Pet from the browser you copied the Snippet in.