Install
Install the script
One small script tag, placed where your stack expects it.
The script loads with defer so it never holds up the page, and counts page changes in single page apps by itself.
Inside <head>, on every page of the site.
<script defer data-website-id="YOUR_SITE_ID"
src="https://earnedstats.com/js/script.js"></script>In the root layout (pages/_app.tsx with the pages router).
import Script from 'next/script';
// inside the root layout
<Script defer data-website-id="YOUR_SITE_ID"
src="https://earnedstats.com/js/script.js" strategy="afterInteractive" />In index.html, inside <head>. Page changes in the app are counted by themselves.
<script defer data-website-id="YOUR_SITE_ID"
src="https://earnedstats.com/js/script.js"></script>In index.html, inside <head>. Router changes are counted by themselves.
<script defer data-website-id="YOUR_SITE_ID"
src="https://earnedstats.com/js/script.js"></script>In nuxt.config.ts, under app.head.
export default defineNuxtConfig({
app: {
head: {
script: [{ src: 'https://earnedstats.com/js/script.js', defer: true, 'data-website-id': 'YOUR_SITE_ID' }],
},
},
});In src/app.html, inside <head>.
<script defer data-website-id="YOUR_SITE_ID"
src="https://earnedstats.com/js/script.js"></script>In your base layout, inside <head>. is:inline keeps it as written.
<script is:inline defer data-website-id="YOUR_SITE_ID"
src="https://earnedstats.com/js/script.js"></script>In your theme's functions.php, or paste the tag into any plugin that adds code to the header.
add_action('wp_head', function () {
echo '<script defer data-website-id="YOUR_SITE_ID" src="https://earnedstats.com/js/script.js"></script>';
});Site settings, Custom code, Head code. Publish the site after saving.
<script defer data-website-id="YOUR_SITE_ID"
src="https://earnedstats.com/js/script.js"></script>Site settings, General, Custom code, start of <head> tag. Publish after saving.
<script defer data-website-id="YOUR_SITE_ID"
src="https://earnedstats.com/js/script.js"></script>Online Store, Themes, Edit code, layout/theme.liquid, just before </head>.
<script defer data-website-id="YOUR_SITE_ID"
src="https://earnedstats.com/js/script.js"></script>Use an AI coding tool? Settings, Tracking, Set up with AI copies a prompt with your real site id that installs the script, revenue and goals in your codebase.
Anything else
Any site that lets you add a tag to <head> works: Ghost, Squarespace, Wix, Hugo, Jekyll, Eleventy, Rails, Django, Laravel and so on. Paste the plain tag:
<script defer data-website-id="YOUR_SITE_ID"
src="https://earnedstats.com/js/script.js"></script>