Social Tools
Flag CounterFree Widget Generator for Your Website
Generates an embeddable widget that shows each visitor their country's flag.
Flag Counter tool
Result ready.
Your flag widget
Preview
Visitors by Country
Powered by Kwebby
Embed code · Minimal
<!-- Kwebby Flag Counter Widget -->
<div id="kwebby-flag-counter" style="font-family:Inter,Arial,sans-serif;max-width:400px;background:#ffffff;border:1px solid #e5e7eb;border-radius:4px;padding:16px">
<p style="font-size:12px;font-weight:700;color:#000000;margin:0 0 12px;text-transform:uppercase;letter-spacing:1px">Visitors by Country</p>
<div style="display:grid;grid-template-columns:repeat(4,1fr);gap:8px">
<!-- The script below shows the flag of the current visitor's country -->
</div>
<p style="font-size:10px;color:#374151;margin:12px 0 0;text-align:right">
Powered by <a href="https://kwebby.com/flag-counter" style="color:#f97316;text-decoration:none;font-weight:700">Kwebby</a>
</p>
</div>
<script>
(function(){
var d=document.getElementById("kwebby-flag-counter");
if(!d)return;
fetch("https://api.country.is/")
.then(function(r){return r.json()})
.then(function(data){
var grid=d.querySelector("div[style*='grid']");
if(!grid)return;
var cc=String(data.country||"");
if(!/^[A-Za-z]{2}$/.test(cc))return;
var flag=cc.toUpperCase().split("").map(function(c){return String.fromCodePoint(127397+c.charCodeAt(0))}).join("");
grid.innerHTML='<div style="text-align:center;padding:6px"><span style="font-size:24px">'+flag+'</span><p style="font-size:10px;color:#374151;margin:4px 0 0">'+cc+'</p></div>';
}).catch(function(){});
})();
</script>- Paste the code into your page's HTML where you want the widget, then save and reload the page.
- If nothing shows up, check whether your editor removes script tags. The widget needs its script to draw a flag.
About the Flag Counter
A small flag in your footer greets each visitor with their own country. Kwebby's Flag Counter builds that widget for you. You pick a style, set a title, copy a short block of code, and paste it into your HTML.
This guide explains what the generated widget does, how to add it step by step, and where a flag counter stops being useful.
Key Takeaways
- The Kwebby Flag Counter is a free generator that creates an embeddable widget. The widget shows each visitor one flag: the country of their own IP address.
- The widget does not count visits, keep totals or list past visitors' countries. Each page view looks up only the current viewer.
- You choose from four style presets (Minimal, Dark, Orange, Compact), set a title and copy the embed code.
- The generated script asks a lightweight IP geolocation API for the viewer's country. The page states it uses no cookies and stores no personal data.
- The preview on the tool page shows a US flag as an example. Use a real analytics tool when you need traffic totals by country.
- No account or signup is required.
- Tell your visitors about the country lookup in your privacy policy.
What Is the Kwebby Flag Counter?
Kwebby's Flag Counter is a free generator that builds an embeddable widget. When someone opens your page, the widget shows the national flag of that visitor's country. It does not store visits, so it never shows a running count or a list of countries. You pick a style and set a title, then copy the code into your page. You do not create an account or sign up.
A flag counter is popular on blogs, forums, portfolio sites and community pages. It gives a page a quick visual sign of a global audience.
Key Features and How It Works
Four Style Presets
Choose Minimal, Dark, Orange or Compact. Minimal suits light pages, Dark suits dark themes, Orange matches the Kwebby look, and Compact saves space in a sidebar. Pick the preset that sits comfortably next to your existing design.
Custom Title
Type your own widget title, such as "Welcome, visitor from" or "You are reading from". The tool escapes the title in the embed code, so quotes and angle brackets cannot break your page. The preview panel updates as you change settings, so you see the layout before you copy anything.
A Short Embed Code
The Embed Code box holds a div and a small script. A Copy Code button puts it on your clipboard. The page describes the code as small and fast loading.
How the Country Lookup Works
When someone loads your page, the script sends a request to the IP geolocation API at api.country.is. The API returns a country code, and the script turns it into a flag. The page says this approach uses no cookies and keeps no personal data.
The widget shows one flag per page view, for the person viewing the page. It keeps no history. If the lookup fails or returns no country, the widget stays empty apart from the title.
Why Flag Counters Matter
A flag widget is a small personal touch: each visitor sees their own country recognized on your page. It is not proof of a global audience, because it shows only the current viewer's flag.
It also has a clear limit. A widget that displays flags is a display element, not a reporting tool. For visits, engagement and trends by country, you need analytics. Google's help page on the GA4 Demographic details report explains that location data is derived from users' IP addresses and lets you compare engagement across countries and regions.
Use the flag counter for the look and analytics for the numbers.
How to Use the Flag Counter
- Open the Flag Counter tool.
- Choose a Style Preset: Minimal, Dark, Orange or Compact.
- Type your Widget Title.
- Check the Preview panel.
- Click Copy Code.
- Paste the code into your page's HTML where you want the counter to appear, then save and reload the page.
If nothing shows up after step 6, check whether your editor removes script tags. Some hosted editors and forums strip them, and the widget needs its script to draw a flag.
Best Practices for Adding a Flag Counter
Match the Style to Your Background
Put the Dark preset on dark themes and Minimal on white pages. A widget that fights your colors looks like clutter.
Place It Where It Adds Value
A footer, an About page or a sidebar works well. Avoid putting it above your main content, because it pushes your headline down and adds nothing for the reader.
Do Not Mistake It for Analytics
A common mistake is reading the widget as a traffic report. It shows only the current viewer's country. Keep a proper analytics tool running next to it and use that for decisions.
Mention the Lookup in Your Privacy Policy
The script contacts a third-party geolocation API, so that service sees the visitor's IP address as part of any web request. Name the lookup in your privacy policy so visitors know what happens on your page. This is general information, not legal advice.
Test Before You Publish
Paste the code into a draft page first. Confirm that the widget loads, that the style fits, and that it does not break your layout on a phone.
Common Use Cases
- Personal blogs. Greet each reader with the flag of their country.
- Forum signatures and profile pages. Add a small Compact widget to a profile that allows custom HTML.
- Portfolio sites. Add a small personal detail for visitors from abroad.
Related Kwebby Tools
The Free Social Tools Online hub collects Kwebby's social and audience tools. These tools fit next to a flag counter:
- Website Hit Counter: styles a static counter badge and lists live counter services, for when you want a number as well as a flag.
- What Is My IP Address: shows your public IP address with the country and city tied to it, which is the kind of data a geolocation lookup works from.
- Social Stats Checker: creates share links for your page across major social platforms, a useful step once your widget is live and you promote the page.
- Meta Tag Generator: builds the title and description tags for the page that hosts your widget.
Final Thoughts
The Kwebby Flag Counter gives you a small, styled widget in about a minute: pick a preset, set a title, copy the code, and paste it into your HTML. Treat it as a visual touch, and keep real analytics for real numbers. Open the tool, preview your layout, and add the widget to your next page.
FAQ
Frequently asked questions
What is a flag counter?
A flag counter is a website widget that shows national flags for your visitors' countries. Many flag counters store visits and show totals. Kwebby's version is simpler: it detects the current visitor's country through an IP geolocation lookup and shows that one flag, with no stored totals.
How do I add a flag counter to my website?
Choose a style, set your title, and click Copy Code. Paste the code into your page's HTML where you want the counter to appear. Save the page and reload it to check the result.
Is the Kwebby flag counter free?
Yes. The generator is free, and it needs no account or signup. You copy the code and use it on your own site.
Does the flag counter track visitors?
The generated code detects the current visitor's country through a lightweight IP geolocation API. The page states that it uses no cookies and stores no personal data. It does not replace analytics software, so use a tool such as Google Analytics for traffic reports.
How many flags can the widget show?
One. The widget shows the flag of the person viewing the page. It does not keep a list of past visitors' countries or show visit counts. Use an analytics tool for that.
Where should I put the flag counter on my page?
Put it in a footer, sidebar or About page, where it supports your content without competing with it. Match the style preset to your page background. Test the page on a phone before you publish.
Kwebby builds software too
Need a website or app built?
Get 50% off your first project. The discount applies to your first fixed quote only. Kwebby has delivered 1,200+ projects on fixed quotes from $100.