# Simple Analytics badge

## AI agent instructions

- Keep the link intact, including the UTM codes. We use it to detect the badge.
- Replace `example.com` in the snippets, including `utm_source=example.com`, with the domain of this website. Get the domain from the app code, like its site URL or deployment config. If it isn't clear, ask the user.
- Look at the color scheme of this website and match the badge colors to its design. If the user shares a design from the badge studio, first ask whether to use that design or to match the website.
- If the website supports dark mode, add dark mode colors too. The badge supports light and dark mode. The text link takes the color of the text around it, so it supports dark mode automatically.
- Ask the user if they want the badge hosted by Simple Analytics or self-hosted. A self-hosted badge can't show the current number of visitors.
- Keeping the link intact, including the UTM codes, is important.

Websites on the free plan show a Simple Analytics badge or text link, usually in the footer. Copy one of the snippets below, or build your own at https://www.simpleanalytics.com/badges.

Replace `example.com` with your domain.

## Rules

- Keep the link exactly as it is, including `utm_source` and `utm_content=badge`. We use it to detect your badge.
- Place it on the pages people visit, for example in a shared footer.
- Don't edit the badge artwork. You can resize it if you keep its proportions.
- With a public dashboard, link to it with `https://www.simpleanalytics.com/example.com?utm_source=example.com&utm_content=badge`.

## Badge hosted by Simple Analytics

The image loads from simpleanalyticsbadges.com. It can show your visitor count.

```html
<a href="https://www.simpleanalytics.com?utm_source=example.com&utm_content=badge" referrerpolicy="origin" target="_blank">
  <img
    src="https://simpleanalyticsbadges.com/example.com?background=edf3f4&text=677779&logo=ff4f64&radius=3&counter=false"
    width="210"
    height="50"
    alt="Simple Analytics"
    loading="lazy"
    referrerpolicy="no-referrer"
    crossorigin="anonymous"
  />
</a>
```

### Image options

Add these to the image URL. Colors are hex without `#`, CSS color names, or `transparent`.

| Option | What it does | Default |
|---|---|---|
| `background` | Background color | `edf3f4` |
| `text` | Text color | `677779` |
| `logo` | Color of the bars | `ff4f64` |
| `border` | Border color. Without it, there is no border. | None |
| `border-width` | Border width in pixels, 1 to 10 | `1` |
| `radius` | Corner radius in pixels | `3` |
| `counter` | `false` hides the visitor count. The count only shows for public dashboards. | Shown when public |
| `mode` | `light`, `dark`, or `auto` to switch with the visitor's dark mode | `auto` |

For separate dark mode colors, add `-light` and `-dark` to the color options, like `background-light=edf3f4&background-dark=2a3638`. Without color options, the badge switches between the light and dark version by itself.

Change `width` and `height` on the image to resize it: 168 × 40 (small), 210 × 50 (medium) or 252 × 60 (large).

### Presets

- Classic: The original. Quiet and recognizable.
  `https://simpleanalyticsbadges.com/example.com?background=edf3f4&text=677779&logo=ff4f64&radius=3&counter=false`
  With a dark mode version: `https://simpleanalyticsbadges.com/example.com?background-light=edf3f4&text-light=677779&logo-light=ff4f64&background-dark=2a3638&text-dark=a4bdc0&logo-dark=ff4f64&radius=3&counter=false`
- Ink: Pure black and white. Works on almost anything.
  `https://simpleanalyticsbadges.com/example.com?background=111111&text=ffffff&logo=ffffff&radius=0&counter=false`
  With a dark mode version: `https://simpleanalyticsbadges.com/example.com?background-light=111111&text-light=ffffff&logo-light=ffffff&background-dark=ffffff&text-dark=111111&logo-dark=111111&radius=0&counter=false`
- Outline: No fill. Self-hosted, it takes the text color of your website.
  `https://simpleanalyticsbadges.com/example.com?background=transparent&text=677779&logo=677779&border=677779&radius=3&border-width=1&counter=false`
- Counter: Shows last month's visits. Needs a public dashboard.
  `https://simpleanalyticsbadges.com/example.com?background=edf3f4&text=677779&logo=ff4f64&radius=3`
  With a dark mode version: `https://simpleanalyticsbadges.com/example.com?background-light=edf3f4&text-light=677779&logo-light=ff4f64&background-dark=2a3638&text-dark=a4bdc0&logo-dark=ff4f64&radius=3`

## Badge on your own website

An inline SVG, so the page makes no requests to third-party domains. It can't show your visitor count, because the count comes from our server.

```html
<a href="https://www.simpleanalytics.com?utm_source=example.com&utm_content=badge" referrerpolicy="origin" target="_blank">
  <svg width="210" height="50" viewBox="0 0 210 50" role="img">
    <title>Simple Analytics: 100% privacy friendly</title>
    <rect width="210" height="50" rx="3" fill="#edf3f4" />
    <path fill="#ff4f64" d="M11 27h5v14h-5zm12-9h5v23h-5zm12-8h5v31h-5z" />
    <path fill="#677779" transform="scale(.1)" d="M529 186v-75h-2l-14 28h-13l19-37h23v84zm60 1c-22-1-32-11-32-33-1-25-1-55 32-54 34 1 33 28 32 54 0 22-10 32-32 33m0-11c13-1 19-8 19-22 1-16 5-42-19-43-23 0-20 28-19 43 0 14 6 21 19 22m77 11c-21-1-31-11-32-33 0-25-1-55 32-54 34 1 33 28 32 54 0 22-10 32-32 33m0-11c13-1 20-8 20-22 0-16 4-42-20-43-23 0-19 28-19 43 0 14 6 21 19 22m56 11-8-6 66-81 8 6zm52 0c-26-2-26-38 0-38 25 0 26 36 0 38m0-8c13-3 12-21 0-21-13 0-13 18 0 21m-46-41c-27-2-26-37 0-38 25 0 26 36 0 38m0-8c12-1 13-21 0-21s-13 19 0 21m108 56v-84c7 0 32-3 44 1 20 8 22 38 3 47-10 5-24 3-34 3v33zm13-44c4 0 18 1 25-1 11-4 12-21 2-26-7-3-22-2-27-2zm59 44v-84c7 0 34-3 46 1 21 7 21 33 3 42v2c17 2 10 30 10 39h-13c0-39 6-33-33-33v33zm13-45c4 0 20 1 27-1 12-4 12-22 1-26-8-2-24-1-28-1zm63 45v-84h13v84zm48 0-24-84h14l20 76h2l20-76h14l-24 84zm45 0 24-84h23l24 84h-14l-5-20h-33l-6 20zm22-32h27l-13-44h-2zm90 33c-20-1-33-13-33-34-1-22-2-48 26-52 7-2 14-1 21 1 12 5 18 17 18 30h-13c0-23-31-29-38-8-3 9-1 23-1 30 0 28 39 30 39 0h13c0 22-11 32-32 33m66-1c0-51 5-22-29-84h14l20 38h2l20-38h15c-34 62-29 33-29 84zm81 0v-84h52v11h-39v25h36v11h-35v37zm65 0v-84c7 0 33-3 46 1 21 7 20 33 3 42v2c17 2 10 30 10 39h-13c0-39 6-33-33-33v33zm13-45c4 0 20 1 27-1 11-4 11-22 0-26-7-2-24-1-27-1zm63 45v-84h13v84zm30 0v-84h53v11h-40v25h37v11h-37v25h41v12zm67 0v-84h25l23 75h2v-75h13v84h-25l-23-76h-2v76zm77 0v-12h11v-61h-11v-11c32 0 68-7 69 34 1 55-19 50-69 50m25-12c31 0 31-9 30-39 0-21-13-21-30-21zm58 12v-84h13v72h41v12zm73 0c0-51 5-22-29-84h14l21 38h1l21-38h14c-34 62-29 33-29 84zM551 398c-33-1-51-16-51-50h20c0 7 0 15 5 21 13 18 54 16 55-10 1-33-93-12-76-72 11-37 75-36 90-3 3 8 3 16 3 25h-20c0-6 0-12-2-18-9-20-55-18-51 9 3 24 59 15 73 43 3 7 4 14 3 21-3 25-27 34-49 34m72-2v-94h19v94zm9-107c-18-1-17-26 0-26 18 0 19 25 0 26m39 107v-94h20v11h3c12-19 40-16 50 3h4c10-18 38-22 52-4s6 80 6 84h-19v-61c-1-11-8-18-18-18-14 0-20 11-20 23v56h-20v-61c0-11-7-18-18-18-13 0-20 11-20 23v56zm163 38V302h20v14h3c7-12 18-17 31-17 54 1 60 88 10 99-16 3-31-2-41-15h-3v51zm49-53c42-3 38-65 0-64-38 0-41 61 0 64m73 15V263h20v133zm92 2c-21-1-39-10-45-30-21-67 66-95 86-40 3 8 3 17 3 26h-72c4 31 39 38 54 11l16 8c-10 17-23 25-42 26Zm-27-59h52c-6-31-46-30-52 0m131 57 38-133h36l38 133h-21l-9-32h-52l-9 32zm35-51h42l-20-70h-3zm95 51v-94h20v14h3c6-11 17-15 29-16 50 0 37 67 37 96h-20v-55c0-14-8-24-22-24-38 0-27 59-27 79zm146 2c-41-1-45-46-18-55 16-5 32-3 48-3 0-5 0-9-2-14-7-17-35-13-41 7l-18-6c3-8 6-15 13-20 16-12 45-11 59 4 15 17 1 65 11 68 3 1 7 0 10 0v17c-10 0-30 3-30-14h-2c-8 12-16 15-30 16m3-16c17-1 27-10 27-27-7 0-28-2-38 2-16 8-5 24 11 25m78 14V263h20v133zm60 38v-17h52c10 0 5-22 5-35h-3c-7 11-16 15-29 16-50 0-37-68-37-96h19v55c0 14 9 24 23 24 38-1 27-59 27-79h20v113c0 11-8 19-19 19zm141-38c-11-1-19-7-19-19v-58h-26v-17h26v-31h20v31h28v17h-28v55c0 10 22 5 25 5v17zm52 0v-94h19v94zm10-107c-19-1-17-27 0-26 18 1 18 25 0 26m82 109c-20-1-39-9-46-30-22-68 74-98 92-32l-19 4c-9-37-57-27-56 10 2 36 48 44 56 8l19 5c-8 24-20 34-46 35m107 0c-23-1-38-8-44-32l18-4c2 4 3 9 6 12 8 10 40 14 40-4-1-22-68-6-59-49 6-28 51-27 67-9 5 5 5 7 8 14l-19 5c-6-23-41-19-37-2 4 19 60 4 59 40 0 9-3 16-10 22-9 6-19 7-29 7" />
  </svg>
</a>
```

Change the `fill` colors, `rx` for the corners, or `width` and `height` to resize it. For a border, add `stroke` and `stroke-width` to the `rect`.

## Text link

Two short lines that use the font, size, color, and alignment of the text around them. No requests to third-party domains.

```html
<style>
  a.sa-credit, a.sa-credit:visited, a.sa-credit:hover, a.sa-credit:active {
    all: unset !important; display: block !important; cursor: pointer !important;
    line-height: 1.6 !important;
  }
  a.sa-credit:focus-visible {
    outline: 2px solid currentColor !important; outline-offset: 4px !important;
  }
  a.sa-credit > span { all: unset !important; }
  a.sa-credit > .sa-credit__byline { white-space: nowrap !important; }
  a.sa-credit svg {
    all: unset !important; display: inline-block !important;
    height: 0.914em !important; vertical-align: -0.2em !important;
    fill: currentColor !important;
  }
  @supports (height: 1cap) {
    a.sa-credit svg { height: 1.305714cap !important; vertical-align: -0.285714cap !important; }
  }
</style>
<a class="sa-credit" href="https://www.simpleanalytics.com?utm_source=example.com&utm_content=badge" referrerpolicy="origin" target="_blank">
  <span class="sa-credit__caption">100% privacy-first analytics</span>
  <span class="sa-credit__byline">by <svg viewBox="0 -714 8871 914" xmlns="http://www.w3.org/2000/svg" role="img"><title>Simple Analytics</title><g transform="translate(0 -700) scale(.7)"><path d="M54 538h154v462H54zm369-276h154v738H423zM792 0h154v1000H792z"/></g><path transform="translate(900 0)" d="M311 14Q232 14 171.0 -14.0Q110 -42 75.5 -96.5Q41 -151 41 -229V-254H148V-229Q148 -154 192.5 -117.5Q237 -81 311 -81Q385 -81 423.5 -112.5Q462 -144 462 -194Q462 -244 422.5 -266.5Q383 -289 314 -305L277 -314Q209 -329 160.0 -353.0Q111 -377 84.0 -416.0Q57 -455 57 -516Q57 -609 123.5 -661.5Q190 -714 299 -714Q372 -714 429.5 -689.0Q487 -664 520.0 -615.0Q553 -566 553 -492V-456H446V-492Q446 -560 405.5 -589.5Q365 -619 299 -619Q234 -619 199.0 -592.5Q164 -566 164 -519Q164 -471 198.5 -448.0Q233 -425 300 -410L337 -401Q404 -386 456.5 -362.5Q509 -339 539.0 -299.0Q569 -259 569 -196Q569 -133 537.5 -86.0Q506 -39 448.0 -12.5Q390 14 311 14ZM686 0V-493H789V0ZM738 -560Q708 -560 687.5 -579.5Q667 -599 667 -630Q667 -661 687.5 -680.5Q708 -700 738 -700Q768 -700 788.5 -680.5Q809 -661 809 -630Q809 -599 788.5 -579.5Q768 -560 738 -560ZM942 0V-493H1043V-435H1059Q1073 -461 1103.5 -481.0Q1134 -501 1188 -501Q1243 -501 1276.5 -478.0Q1310 -455 1327 -421H1343Q1359 -455 1392.0 -478.0Q1425 -501 1485 -501Q1556 -501 1603.5 -456.5Q1651 -412 1651 -328V0H1548V-321Q1548 -365 1523.5 -389.5Q1499 -414 1454 -414Q1406 -414 1377.0 -383.0Q1348 -352 1348 -294V0H1245V-321Q1245 -365 1220.5 -389.5Q1196 -414 1151 -414Q1103 -414 1074.0 -383.0Q1045 -352 1045 -294V0ZM1799 200V-493H1900V-422H1916Q1935 -455 1973.5 -481.0Q2012 -507 2084 -507Q2145 -507 2197.0 -477.0Q2249 -447 2280.5 -390.0Q2312 -333 2312 -254V-239Q2312 -159 2280.5 -102.5Q2249 -46 2197.5 -16.0Q2146 14 2084 14Q2012 14 1973.5 -11.5Q1935 -37 1918 -67H1902V200ZM2054 -76Q2121 -76 2164.5 -119.0Q2208 -162 2208 -242V-251Q2208 -330 2164.5 -373.0Q2121 -416 2054 -416Q1988 -416 1944.5 -373.0Q1901 -330 1901 -251V-242Q1901 -162 1944.0 -119.0Q1987 -76 2054 -76ZM2440 0V-700H2543V0ZM2922 14Q2847 14 2791.0 -17.5Q2735 -49 2703.5 -106.0Q2672 -163 2672 -240V-252Q2672 -329 2703.5 -386.0Q2735 -443 2790.0 -475.0Q2845 -507 2918 -507Q2989 -507 3042.5 -475.5Q3096 -444 3126.0 -388.0Q3156 -332 3156 -257V-218H2777Q2779 -153 2820.5 -114.5Q2862 -76 2924 -76Q2982 -76 3011.5 -102.0Q3041 -128 3057 -162L3143 -118Q3128 -90 3102.0 -59.0Q3076 -28 3032.0 -7.0Q2988 14 2922 14ZM2778 -297H3052Q3047 -352 3011.0 -384.0Q2975 -416 2917 -416Q2859 -416 2822.5 -384.0Q2786 -352 2778 -297ZM3468 0 3667 -700H3857L4056 0H3945L3899 -165H3625L3579 0ZM3652 -265H3872L3770 -633H3754ZM4154 0V-493H4255V-419H4271Q4285 -449 4321.0 -475.0Q4357 -501 4428 -501Q4484 -501 4527.5 -476.0Q4571 -451 4596.0 -405.0Q4621 -359 4621 -296V0H4518V-288Q4518 -352 4486.0 -382.5Q4454 -413 4398 -413Q4334 -413 4295.5 -371.0Q4257 -329 4257 -249V0ZM4922 14Q4869 14 4827.5 -4.0Q4786 -22 4761.5 -57.0Q4737 -92 4737 -142Q4737 -217 4790.5 -255.5Q4844 -294 4925 -294H5075V-326Q5075 -368 5049.0 -394.5Q5023 -421 4969 -421Q4916 -421 4888.0 -396.0Q4860 -371 4851 -331L4755 -362Q4767 -401 4793.5 -434.0Q4820 -467 4863.5 -487.0Q4907 -507 4970 -507Q5066 -507 5121.0 -458.0Q5176 -409 5176 -319V-116Q5176 -86 5204 -86H5246V0H5169Q5135 0 5113.0 -18.0Q5091 -36 5091 -67V-70H5075Q5067 -54 5051.0 -34.5Q5035 -15 5004.0 -0.5Q4973 14 4922 14ZM4937 -71Q4998 -71 5036.5 -106.5Q5075 -142 5075 -204V-214H4931Q4890 -214 4865.0 -196.5Q4840 -179 4840 -145Q4840 -111 4866.0 -91.0Q4892 -71 4937 -71ZM5346 0V-700H5449V0ZM5659 200V110H5934Q5962 110 5962 80V-72H5946Q5932 -43 5896.5 -17.0Q5861 9 5791 9Q5735 9 5691.0 -16.0Q5647 -41 5622.0 -87.0Q5597 -133 5597 -196V-493H5700V-204Q5700 -140 5732.0 -109.5Q5764 -79 5821 -79Q5884 -79 5922.5 -121.5Q5961 -164 5961 -243V-493H6064V101Q6064 146 6037.5 173.0Q6011 200 5965 200ZM6401 0Q6356 0 6329.5 -27.0Q6303 -54 6303 -99V-406H6167V-493H6303V-656H6406V-493H6553V-406H6406V-117Q6406 -87 6434 -87H6537V0ZM6674 0V-493H6777V0ZM6726 -560Q6696 -560 6675.5 -579.5Q6655 -599 6655 -630Q6655 -661 6675.5 -680.5Q6696 -700 6726 -700Q6756 -700 6776.5 -680.5Q6797 -661 6797 -630Q6797 -599 6776.5 -579.5Q6756 -560 6726 -560ZM7159 14Q7088 14 7030.5 -16.0Q6973 -46 6939.5 -103.0Q6906 -160 6906 -240V-253Q6906 -332 6939.5 -389.0Q6973 -446 7030.5 -476.5Q7088 -507 7159 -507Q7230 -507 7280.5 -481.0Q7331 -455 7360.5 -412.0Q7390 -369 7400 -317L7300 -296Q7293 -345 7259.5 -380.0Q7226 -415 7161 -415Q7097 -415 7053.0 -372.0Q7009 -329 7009 -251V-242Q7009 -164 7053.0 -121.0Q7097 -78 7161 -78Q7226 -78 7260.0 -111.5Q7294 -145 7303 -197L7403 -174Q7391 -123 7360.5 -80.0Q7330 -37 7280.0 -11.5Q7230 14 7159 14ZM7724 14Q7629 14 7567.0 -28.0Q7505 -70 7492 -155L7588 -178Q7599 -116 7636.5 -92.5Q7674 -69 7724 -69Q7773 -69 7799.5 -87.5Q7826 -106 7826 -137Q7826 -167 7801.0 -181.0Q7776 -195 7728 -204L7693 -210Q7643 -219 7602.0 -236.0Q7561 -253 7537.0 -283.0Q7513 -313 7513 -360Q7513 -430 7565.0 -468.5Q7617 -507 7703 -507Q7786 -507 7839.5 -469.5Q7893 -432 7909 -368L7813 -341Q7804 -386 7775.0 -404.5Q7746 -423 7703 -423Q7661 -423 7637.0 -407.5Q7613 -392 7613 -364Q7613 -334 7636.5 -320.0Q7660 -306 7700 -299L7735 -293Q7788 -284 7831.5 -267.5Q7875 -251 7901.0 -221.5Q7927 -192 7927 -142Q7927 -67 7871.5 -26.5Q7816 14 7724 14Z"/></svg></span>
</a>
```

## Content Security Policy

- Hosted badge: add `img-src simpleanalyticsbadges.com` to your policy.
- Badge on your own website and text link: nothing to add.

## Free-plan checks

- The first check runs 14 days after your website's first analytics visit. After that, we check roughly every 30 days.
- If the badge is missing, you get a 14-day warning. If it's still missing, dashboard data, API access, and exports are locked. We keep collecting events, and access returns after the badge is added and checked again.
