
Recherche avancée
Médias (91)
-
Les Miserables
9 décembre 2019, par
Mis à jour : Décembre 2019
Langue : français
Type : Textuel
-
VideoHandle
8 novembre 2019, par
Mis à jour : Novembre 2019
Langue : français
Type : Video
-
Somos millones 1
21 juillet 2014, par
Mis à jour : Juin 2015
Langue : français
Type : Video
-
Un test - mauritanie
3 avril 2014, par
Mis à jour : Avril 2014
Langue : français
Type : Textuel
-
Pourquoi Obama lit il mes mails ?
4 février 2014, par
Mis à jour : Février 2014
Langue : français
-
IMG 0222
6 octobre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Image
Autres articles (97)
-
ANNEXE : Les plugins utilisés spécifiquement pour la ferme
5 mars 2010, parLe site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)
-
L’agrémenter visuellement
10 avril 2011MediaSPIP est basé sur un système de thèmes et de squelettes. Les squelettes définissent le placement des informations dans la page, définissant un usage spécifique de la plateforme, et les thèmes l’habillage graphique général.
Chacun peut proposer un nouveau thème graphique ou un squelette et le mettre à disposition de la communauté. -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs
Sur d’autres sites (6953)
-
How to Check Website Traffic : A Complete Guide
26 février, par Daniel Crough — Analytics Tips, MarketingIf you want to learn about the health of your website and the success of your digital marketing initiatives, there are few better ways than checking your website traffic.
Checking website traffic is a great way to get a dopamine hit when things are up. And it’s a great way to troubleshoot problems when things go down. It’s also a critical data source for marketing and web teams. But to get the most out of it, you need reliable data sources, the ability to track them over time and a way to monitor the competition.
This article explains how to check website traffic (for your site and your competitors), explores nine tools that can help and discusses why some methods are better than others.
Why check website traffic ?
Dopamine hits aside, monitoring website traffic is crucial to a business — even for a primarily brick-and-mortar operation. In this internet age, customers and prospects are far more likely to research a company online before buying anything.
SOCi’s 2024 Consumer Behavior Index found that 8 in 10 US consumers use the internet to search for local businesses at least once a week. And Statista found that 55% of UK shoppers always do some online research before making a major purchase.
And trend lines suggest these numbers are likely to continue climbing. Businesses need to know what’s happening on their sites, and that’s difficult to achieve without traffic data.
Indeed, website data allows companies to better understand their target audiences, measure the effectiveness of marketing efforts and channels, and identify areas of the website that need work.
Let’s dig into those ideas in a little more detail.
Benchmark site performance
Keeping regular tabs on traffic levels is a great way to track a website’s performance over time. It can help with planning for the future and identifying current problems.
For instance, rising traffic levels may mean expanding the business’s offering or investing in more inventory. On the flip side, decreasing traffic levels may suggest it’s time to revamp marketing strategies or look into issues impacting SEO.
Analyse user behaviour
Checking website traffic, user behaviour, and other metrics shows marketing managers how users interact with the website. These traffic stats can help answer questions like :
- Which pages are users visiting ?
- Which CTAs are they clicking on ?
- Which page elements encourage users to take the desired actions ?
It can also identify issues contributing to high bounce rates or declines in search rankings.
The better user behaviour is understood, the easier it is to give visitors what they want. For example, the data could reveal that users spend more time on landing pages than blogs. These valuable insights can be used to optimise blog content and improve performance.
Improve the user experience
Once user behaviour is well understood, it’s easier to make adjustments, update content and improve the overall user experience. This also allows companies to create more personalised customer experiences, which can lead to growth. Research shows companies that get personalisation right generate 40% more revenue from those activities than average players.
That could take the form of sweeping changes like rearranging a website’s navigation bar based on user behaviour. It could also be personalisation that uses analytics to transform sections or entire pages based on individual user behaviour.
Optimise digital marketing strategies
Knowing current traffic levels and how they trend over time helps teams set benchmarks and prioritise marketing efforts.
Monthly traffic reports can inform SEO efforts and benefit marketing attribution. For example, they could indicate when the time is right to double down on organic traffic or when the better strategy would be to invest more in PPC advertising.
Increasing organic traffic levels from other countries can help businesses identify new marketing opportunities. If traffic levels from a neighbouring country or a growing market increase significantly, it could be time for a cross-border campaign.
Filter unwanted traffic
A significant chunk of every website’s traffic comes from bots and other unwanted sources. This can compromise the quality of website data and make it harder to draw useful insights. While it’s nearly impossible to get rid of this traffic completely, many analytics tools have features to filter it out of the stats.
Why check competitors’ website traffic
Websites are windows into businesses and their strategies. That’s why monitoring traffic and other metrics drawn from competitors is essential.
There’s a lot to learn from the competition, both good and bad. What competitors do well can be replicated, and learning from the elements they get wrong can help you avoid making the same mistakes.
- Strategic planning : Looking at traffic on specific pages can offer insight into potential marketing campaigns and highlight gaps in the market that may be worth attacking. Looking at their organic, paid, social and referral traffic levels can highlight opportunities for growth or pinpoint the reasons for success in a particular area.
- Benchmarking : Looking at website traffic in isolation can lack context. Monitoring other sites’ engagement metrics, like bounce rate and average session duration, can give you an inside look at the competition, which can help you set realistic performance goals and benchmarks.
- Product Development : Significant traffic volume on certain pages can indicate shifts in demand and market trends, which may inform the development of new products or services. For example, if a competitive dog food supplier ranks well for the term “organic dog food”, that might be something to consider when formulating new products.
- Audience demographics : Comparing audience demographics between competitors can highlight opportunities and help a business narrow down its target audience. This guides messaging and campaign strategies to capture specific audience segments.
- Keyword opportunities : Examining the keywords driving the most traffic to a competitor’s website can help you uncover untapped SEO potential for your website. Analysing top-performing content on competing sites can help identify content improvement strategies to pull traffic away from competitors.
- Partnerships : Referrals are an often overlooked traffic metric. High volumes of such traffic indicate successful partnerships between competitors and third parties, which is a model worth emulating.
7 key website traffic metrics to track
Traffic metrics are not a case of one-size-fits-all. Those that are important today may not be tomorrow. It all depends on the priorities and goals at any one moment. That said, there are a few traffic metrics that always matter to some degree.
- New visitors : These are users who have never visited the website before. They are a great sign that marketing efforts are working and the website is reaching more people. But it’s also important to track how they behave on the website to ensure the site caters effectively to the needs of new visitors.
- Returning visitors : Returning visitors are coming back to the website for a reason : either they like the content they find or want to buy something. Either way, it’s excellent news. The more returning visitors, the better.
- Bounce rate : This measures how many users leave the website without taking action. Different analytics tools measure this metric differently.
- Session duration : This is the time users spend on the website, which can reveal whether they find the site engaging. And when considered alongside the next metric, it can be especially insightful.
- Pages per session : This measures the average number of pages users visit on a website. The more pages they visit and the longer users spend on the website, the more engaging it is.
- Traffic source : Traffic can come from various sources (organic, direct, social media, referral, etc.). Knowing the highest sources of referral traffic can help analyse and prioritise marketing efforts.
- User demographics : This shows who visits a website, what device they use, what country they come from, etc. While most website traffic will come from the countries targeted by marketing, an influx of new users from other countries can open the door to new opportunities.
9 tools to check website traffic
There are thousands of different web analytics tools that can provide decent website traffic analysis and functionality checks. They all use a similar combination of sophisticated algorithms, data collection techniques, statistical analysis and machine learning to deliver insights into visitor behaviour and site performance.
Most web analytics tools work by embedding bits of JavaScript or other tracking codes into a website. When users land on a website, it gathers data such as page views, session duration, and specific interactions. Many also use cookies to identify returning visitors, which lets them monitor user behaviour over time.
Many tools offer advanced event-tracking functionality. This captures specific actions, like clicks or form submissions, and provides a more granular view of engagement. The data is then statistically analysed to spot trends and calculate key metrics like bounce rates and conversion rates.
Some web analytics tools use machine learning to predict future user behaviour based on historical patterns. Others aggregate data to provide insights via charts comparing website performance with selected competitors’ websites.
This section explores nine popular tools for checking website traffic and highlights their unique features and benefits.
1. Checking website traffic with Google Analytics
Google Analytics is usually the first place to start for anyone looking to check their website traffic. It’s free to use, incredibly popular and offers a wide range of traffic reports.
It breaks down historical traffic data in many different ways. It can split traffic by acquisition channel (organic, social media, direct, etc.), by country, device or demographic. It also provides real-time traffic reports that offer a snapshot of users on the site right now and over the last 30 minutes.
GA4’s Traffic acquisition report helps to understand where website and app visitors are coming from. Image source Google Analytics may be one of the most popular ways to check website traffic, but it could be better. Google Analytics 4 (GA4) is difficult to use compared to its predecessor, and it also imposes data tracking limits in accordance with privacy laws. If users refuse cookie consent, Google Analytics won’t record those visits. In other words, using Google Analytics alone doesn’t provide a complete view of the traffic.
GA4 can also help to pinpoint the pages and screens that receive the most traffic. Image source Also, GA4 relies on sampling when processing large datasets or complex queries. When the volume of data exceeds certain thresholds, it only considers a subset of the data to generate reports instead of processing every single data point.
There are pros and cons to this approach. While it speeds up analysis and reduces the load on the system, it can also lead to inaccuracies in insights delivered. When analysing traffic patterns over a busy period, GA4 may only use a portion of the data to calculate and then extrapolate metrics.
As a result, trends or anomalies might be overlooked or misconstrued, which could mean missed opportunities or poor decisions. That’s why it’s important to use Google Analytics alongside other web analytics tools (like Matomo) that don’t suffer from the same privacy issues. That way, it’s possible to track every single user who visits the website.
2. Checking website traffic with Google Search Console
Google Search Console is a free tool that analyses a website’s Google search traffic. The top-line report shows how many times the website has appeared in Google Search, how many clicks it has received, the average clickthrough rate and its average position in the search results.
Google Search Console can reveal keyword patterns and spikes in interest Image source It’s a great way to understand what the website ranks for and how much traffic organic rankings generate. It will also show which pages are indexed in Google and whether there are any crawling errors.
Unfortunately, Google Search Console is limited if a complete view of traffic is needed. While the search traffic can be analysed in great detail, it will not report how users who access the website behave on it.
3. Checking website traffic with Similarweb
Similarweb is a website analysis tool that estimates the total traffic of any site on the internet. It is one of the best traffic checker tools for estimating how much web traffic competitors receive.
What’s great about Similarweb is that it estimates total traffic, not just traffic from search engines like many SEO tools. It even breaks down traffic by different channels for easy comparison.
Similarweb’s dashboard reveals how traffic levels increase or decrease month-over-month. Image source Similarweb provides an estimate of total visits, bounce rate, the average number of pages users view per visit and the average duration on the site. The company also has a free browser extension that continues checking website traffic estimates while the user is browsing the web.
Similarweb is free to use, up to a point. However, to get the most out of this tool, you must upgrade to the premium plan, which starts at $125 per user per month.
The price isn’t Similarweb’s only downside. Ultimately, it provides reasonably accurate estimates but is no match for a comprehensive traffic analytics tool.
4. Checking website traffic with Semrush
Semrush is a collection of marketing solutions for online businesses. Its Traffic Analytics tool checks the website traffic of up to 100 sites and compares that data side-by-side. For each site, it reveals the top pages, the regions from which most of the traffic comes, and the locations from which the most referrals come.
Semrush also gathers insights into competitors’ audiences and their activity, especially activity that overlaps between the sites being checked. It extracts and analyses comprehensive data on organic and paid search, social media, and backlinks.
Semrush’s traffic analytics monitors traffic stats for competitor websites. Image source However, there are notable downsides. Semrush can be pricey, with plans starting at about $119.95 per month or $1,199.40 annually. This cost may be prohibitive for smaller businesses or freelancers. Still, a free version offers most of the functionality but with a limited number of daily reports.
5. Checking website traffic with Ahrefs
Ahrefs‘s biggest strength is its organic traffic estimation capabilities. It estimates monthly visits from Google worldwide, Google keywords in the top 100 that a website ranks for, and traffic value via equivalence to PPC.
Ahrefs’ SEO dashboard uses trend graphs to show how projects are performing. Image source Ahrefs bases its estimates on ranking data from a database of 12 billion keywords, which is why it is so powerful. It generates a detailed report that includes organic traffic estimates, backlink data, and top-performing keywords.
However, the numbers produced by Ahrefs are estimates based on the available data and won’t always be 100% accurate. This is particularly true for smaller or newer websites that lack the data volumes needed for accuracy.
It’s a great SEO marketing tool that’s free to use within certain limits, but there is some value in registering for a paid plan. There are several options, beginning with the $129 per month Lite plan and extending to the Enterprise Plan for $1,499 monthly.
6. Checking website traffic with Serpstat
Serpstat is an SEO solution that grew from a simple keyword research tool. It offers more comprehensive features to help businesses understand their website’s performance. It helps improve a site’s visibility through tools for rank tracking, keyword research, traffic checking, backlink analysis, and site auditing.
Serpstat’s Domain Analytics dashboard shows trends over a 12-month period. Image source It provides metrics like estimated monthly visits, traffic sources (organic, paid, and referral), and insights into top-performing pages. Serpstat also offers competitor analysis features that help to identify market trends and refine growth strategies. However, like Ahrefs, the numbers provided are estimates, which are only as good as the depth of data from which they are derived.
The free version is fine for basic analysis, but signing up for one of the paid plans is advisable for commercial use. Pricing ranges from $59 per month to a monthly fee of $479 for the Agency plan. There is an option to pay annually at a discount.
7. Checking website traffic with SEO PowerSuite
SEO PowerSuite also goes some distance beyond just website traffic checking. As the name implies, it’s a suite of tools to improve website rankings.
Rank Tracker’s SEO dashboard reveals organic session growth over time. Image source. There are four tools in the suite :
- Rank Tracker enables tracking a website’s search engine rankings across multiple keywords and search engines.
- WebSite Auditor offers SEO analysis of website pages and recommends actions to boost performance.
- SEO SpyGlass analyses a website’s backlink profile to highlight link-building possibilities that’d help improve performance.
- LinkAssistant helps identify websites suitable for link-building and recommends viable outreach opportunities.
SEO PowerSuite has a free plan and two premium plans with varying functionality. The monthly cost could be as much as $139.67, depending on the features needed. Annual pricing options are also available.
8. Checking website traffic with Ubersuggest
Ubersuggest is also an SEO-focused tool. It offers website traffic analysis, keyword rankings, backlink profiles, and competitor insights. These are packaged in reports that provide an overview of website traffic, including monthly organic traffic totals and the number of organic keywords the site ranks for. Ubersuggest also offers content suggestions.
Ubersuggest’s Domain Overview Dashboard provides an overview of a website’s traffic. Image source Like other tools in this category, Ubersuggest doesn’t collect comprehensive data, so its numbers are estimates. This means the accuracy can vary. However, it remains a solid choice for providing great insights and enhancing a website’s online presence.
Like many tools in this category, there is a free version to give potential customers a taste, which is restricted by volume more than features. The paid plans range from around $29 per month for one website on the individual plan to about $99 per month for 8-15 websites on the Enterprise plan. Discounted annual pricing is also an option.
9. Checking website traffic with MonsterInsights
MonsterInsights is a tool worth considering for websites built on WordPress because it’s not a website checking tool in the usual sense. It’s a WordPress plugin that simplifies the task by integrating Google Analytics directly into a website.
MonsterInsights then uses the raw data provided by GA4 to extract actionable insights based on audience preferences and activity. This makes it easier to focus on the relevant metrics for different types of websites. For example, the metrics used to measure a blog site would not be the same as those for an ecommerce site.
But there are some downsides, too. While the basic version is free, it has limited features, and the most potent functionality requires a premium subscription. Those start at $249 per year for a single site, or the Pro plan at $499 for up to five sites. Agencies looking to work with up to 25 sites are in for $999.
MonsterInsights’ Analytics Overview offers a snapshot of a website’s traffic volumes. Image source There’s another option
Although many of these tools have free versions, those tend to be heavily restricted, and premium plans can be expensive. A website has to generate serious revenue to deliver a decent return on investment (ROI) to justify the costs.
As more countries adopt GDPR-like privacy regulations, brands must ensure they’re using compliant, privacy-centric analytics tools.
Matomo Analytics is one such tool. It’s an ethical, open-source solution that helps you collect accurate data about your website’s traffic and make more informed decisions. This enhances the customer experience and ensures GDPR compliance and user privacy.
It’s completely free to install as an on-premise solution. Alternatively, there’s the subscription-based Matomo Cloud version.
How to check website traffic on Matomo
Apart from a better ROI picture, Matomo offers a more reliable assessment of your website’s traffic than Google Analytics 4. It also provides multiple ways to check organic search traffic :
- Visits log report
- Real-time visitor map
- Visits in real-time report
Let’s look at all of them one by one.
The visits log report is a unique rundown of your site’s visitors. It offers a much more granular view than other traffic checker tools, which only show the total number of visitors for a given period.
Matomo’s Visits Log Report provides a detailed breakdown of all website visitors. You can access the visits log report by clicking on the reporting menu and then clicking Visitor and Visits Log. From there, you’ll be able to scroll through every user session and see the following information :
- The location of the user
- The total number of actions they took
- The length of time on site
- How they arrived at your site
- The device they used to access your site
It may be overwhelming if your site receives thousands of visitors at a time. But it’s a great way to understand users at an individual level and appreciate the lifetime activity of specific users.
The Real-time visitor map shows site visitors’ location for a given timeframe. If you have an international website, it’s a fantastic way to see exactly where your traffic comes from.
Matomo’s Geo-Location dashboard reveals where website visitors are located. Image source You can access the Real-time Visitor Map by clicking Visitor in the main navigation menu and then Real-time Map. The map itself is colour-coded. Larger orange bubbles represent recent visits, and smaller dark orange and grey bubbles represent older visits. The map will refresh every five seconds, and new users appear with a flashing effect.
If you run TV or radio adverts, Matomo’s Real-time Map provides an immediate read on the effectiveness of your campaign. If your map lights up in the minutes following your ad, you know it’s been effective. It can also help you identify the source of bot attacks, too.
Finally, the Visits in Real-time report provides a snapshot of who is browsing your website. You can access this report under Visitors > Real-time and add it to your custom dashboards as a widget.
Open the report, and you’ll see the real-time flow of your site’s users and counters for visits and pageviews over the last 30 minutes and 24 hours. The report refreshes every five seconds with new users added to the top of the report with a fade-in effect.
Matomo’s Visits in Real-time report displays new visits or current visitors viewing a new page. Image source The report provides a snapshot of each visitor, including :
- Whether they are new or returning
- Their country
- Their browser
- Their operating system
- The number of actions they took
- The time they spent on the site
- The channel they came in from
- Whether the visitor converted a goal
Why do my traffic reports differ ?
If you use more than one of the methods above to check your website traffic, you’ll quickly realise that every traffic report differs. In some cases, the reasons are obvious. Any tool that estimates your traffic without adding code to your website is just that : an estimate. Tools like many of those mentioned here will never offer the accuracy of analytics platforms like Matomo and Google Analytics.
But what about the differences between these analytics platforms themselves ? While each platform records user behaviour differently, significant differences in website traffic reports between analytics platforms are usually due to how each platform handles user privacy.
A platform like Google Analytics requires users to accept a cookie consent banner to track them. If they accept, great. Google collects all of the data that any other analytics platform does. It may even collect more. However, if users reject cookie consent banners, Google Analytics can’t track them. They simply won’t show up in your traffic reports.
That doesn’t happen with all analytics platforms, however. A privacy-focused alternative like Matomo doesn’t require cookie consent banners (apart from in the United Kingdom and Germany). Therefore, it can continue to track visitors even after they have rejected a cookie consent screen from Google Analytics. This means virtually all website traffic will be tracked regardless of whether users accept a cookie consent banner. And it’s why traffic reports in Matomo are often much higher than in Google Analytics.
Many adults in the EU refuse to allow tracking for advertising purposes, and most reject cookies when they can. This means different analytics tools can offer vastly different traffic stats. Around half (47.32%) of adults in the European Union refuse to allow personal data tracking for advertising purposes, and 95% of people will reject additional cookies when it is easy to do so. So relying on cookies limits your results — and causes you to miss out on valuable user data.
If you’re serious about using web analytics to improve your website and optimise your marketing campaigns, then it is essential to use another analytics platform alongside Google Analytics.
What to do if website traffic levels drop
Experiencing a drop in website traffic can be frustrating, but it happens to everyone at some point. Here’s how to address it :
- Analyse traffic sources : Use analytics tools to pinpoint where the decline is coming from—organic search, referrals, or social media.
- Check for technical issues : Look for broken links or slow loading times, which can deter visitors. Tools like Google Search Console can help identify errors.
- Review recent changes : Consider any recent updates to the website. If something coincided with the drop, it might be worth reverting.
- Evaluate content quality : Ensure the content is engaging and relevant. Update or improve underperforming posts.
- Reassess the marketing strategy : The only constant in marketing is change. It’s wise to periodically revisit the balance between paid ads, social media and other vectors to evaluate their effectiveness and adjust the approach.
It’s perfectly normal for website traffic volumes to fluctuate. Expect it and work with the available tools. Persistence will likely see the traffic volumes rebound.
Get more accurate traffic reports with Matomo
There are several methods to check website traffic. Some can provide estimates on your competitors’ traffic levels. Others, like Google Analytics, are free. But data doesn’t lie. Only privacy-focused analytics solutions like Matomo can provide accurate reports that account for every visitor.
Join over one million organisations using Matomo to check their website traffic accurately and ethically.
Try Matomo for Free
Start your 21-day free trial — no credit card required.
-
What is audience segmentation ? The 8 main types and examples
8 juillet, par JoeMarketers must reach the right person at the right time with the most relevant messaging. Customers now expect personalised experiences, which means generic campaigns won’t work. Audience segmentation is the key to doing this.
This isn’t an easy process because there are many types of audience segmentation. The wrong approach or poor data management can lead to irrelevant messaging or lost customer trust.
This article breaks down the most common types of audience segmentation with examples highlighting their usefulness and information on segmenting campaigns without breaking data regulations.
What is audience segmentation ?
Audience segmentation involves dividing a customer base into distinct, smaller groups with similar traits or common characteristics. The goal is to deliver a more targeted marketing message or to glean unique insights from analytics.
It can be as broad as dividing a marketing campaign by location or as specific as separating audiences by their interests, hobbies and behaviour.
Consider this : an urban office worker and a rural farmer have vastly different needs. Targeted marketing efforts aimed at agriculture workers in rural areas can stir up interest in farm equipment.
Audience segmentation has existed since the beginning of marketing. Advertisers used to select magazines and placements based on who typically read them. For example, they would run a golf club ad in a golf magazine, not the national newspaper.
Now that businesses have more customer data, audience segments can be narrower and more specific.
Why audience segmentation matters
Hyken’s latest Customer Service and CX Research Study revealed that 81% of customers expect a personalised experience.
These numbers reflect expectations from consumers who have actively engaged with a brand — created an account, signed up for an email list or purchased a product.
They expect relevant product recommendations — like a shoe polishing kit after buying nice leather loafers.
Without audience segmentation, customers can get frustrated with post-sale activities. For example, the same follow-up email won’t make sense for all customers because each is at a different stage of the user journey.
Some more benefits that audience segmentation offers :
- Personalised targeting is a major advantage. Tailored messaging makes customers feel valued and understood, enhancing their loyalty to the brand.
- Businesses can understand users’ unique needs, which helps in better product development. For example, a fitness brand might develop separate offerings for casual exercisers and professional athletes.
- Marketers can allocate more resources to the most promising segments. For example, a luxury skincare brand might target affluent customers with premium ads and use broader campaigns for entry-level products.
8 types of audience segmentation
There are eight types of audience segmentation : demographic, behavioural, psychographic, technographic, transactional, contextual, lifecycle and predictive segmentation.
Let’s take an in-depth look at each of them.
Demographic segmentation
Demographic segmentation divides a larger audience based on data points like location, age or other factors.
The most basic segmentation factor is location, which is critical in marketing campaigns. Geographic segmentation can use IP addresses to separate marketing efforts by country.
But more advanced demographic data points are becoming increasingly sensitive to handle, especially in Europe, where the GDPR makes advanced demographics a more tentative subject.
It’s also possible to use age, education level, and occupation to target marketing campaigns. It’s essential to navigate this terrain thoughtfully, responsibly, and strictly adhere to privacy regulations.
Potential data points :
- Location
- Age
- Marital status
- Income
- Employment
- Education
Example of effective demographic segmentation :
A clothing brand targeting diverse locations must account for the varying weather conditions. In colder regions, showcasing winter collections or insulated clothing might resonate more with the audience. Conversely, promoting lightweight or summer attire would be more effective in warmer climates.
Here are two ads run by North Face on Facebook and Instagram to different audiences to highlight different collections :
Each collection features differently and uses a different approach with its copy and even the media. With social media ads, targeting people based on advanced demographics is simple enough — just single out the factors when building a campaign. And it’s unnecessary to rely on data mining to get information for segmentation.
Consider incorporating a short survey into email sign-up forms so people can self-select their interests and preferences. This is a great way to segment ethically and without the need for data-mining companies. Responses can offer valuable insights into audience preferences while enhancing engagement, decreasing bounce rates, and improving conversion rates.
Behavioural segmentation
Behavioural segmentation segments audiences based on their interaction with a website or an app.
Potential data points :
- Page visits
- Referral source
- Clicks
- Downloads
- Video plays
- Conversions (e.g., signing up for a newsletter or purchasing a product)
Example of using behavioural segmentation to improve campaign efficiency :
One effective method involves using a web analytics tool like Matomo to uncover patterns. By segmenting actions like specific clicks and downloads, identify what can significantly enhance visitor conversions.
For example, if a case study video substantially boosts conversion rates, elevate its prominence to capitalise on this success.
Then, set up a conditional CTA within the video player. Make it pop up after the user finishes watching the video. Use a specific form and assign it to a particular segment for each case study. This way, you can get the prospect’s ideal use case without surveying them.
This is an example of behavioural segmentation that doesn’t rely on third-party cookies.
Psychographic segmentation
Psychographic segmentation involves segmenting audiences based on interpretations of their personality or preferences.
Potential data points :
- Social media patterns
- Follows
- Hobbies
- Interests
Example of effective psychographic segmentation :
Here, Adidas segments its audience based on whether they like cycling or rugby. It makes no sense to show a rugby ad to someone who’s into cycling and vice versa. However, for rugby athletes, the ad is very relevant.
Brands that want to avoid social platforms can use surveys about hobbies and interests to segment their target audience ethically.
Technographic segmentation
Technographic segmentation separates customers based on the hardware or software they use.
Potential data points :
- Type of device used
- Device model or brand
- Browser used
Example of segmenting by device type to improve user experience :
After noticing a serious influx of tablet users accessing their platform, a leading news outlet optimised their tablet browsing experience. They overhauled the website interface, focusing on smoother navigation and better tablet-readability. These changes gave users a more enjoyable reading experience tailored precisely to their device.
Transactional segmentation
Transactional segmentation uses customers’ past purchases to match marketing messages with user needs.
Consumers often relate personalisation with their actual transactions rather than their social media profiles.
Potential data points :
- Average order value
- Product categories purchased within X months
- Most recent purchase date
Example of effective transactional segmentation :
Relevant product recommendations and coupons are among the best uses of transactional segmentation. These individualised marketing emails can strengthen brand loyalty and increase revenue.
A pet supply store identifies a segment of customers who consistently purchase cat food but not other pet products. To encourage repeat purchases within this segment, the store creates targeted email campaigns offering discounts or loyalty rewards for cat-related items.
Contextual segmentation
Contextual segmentation helps marketers connect with audiences based on real-time factors like time of day, weather or location. It’s like offering someone exactly what they need when they need it the most.
Potential data points :
- GPS location
- Browsing activity
- Device type
Examples of contextual segmentation :
A ride-hailing app might promote discounted rides during rush hour in busy cities or suggest carpooling options on rainy days. Similarly, an outdoor gear retailer could target users in snowy regions with ads for winter jackets or snow boots.
The key is relevance. Messages that align with what someone needs at that moment feel helpful rather than intrusive. Businesses need tools like geolocation tracking and real-time analytics to make this work.
Also, keep it subtle and respectful. While personalisation is powerful, being overly intrusive can backfire. For example, instead of bombarding someone with notifications every time they pass a store, focus on moments when an offer truly adds value — like during bad weather or peak commute times.
Lifecycle segmentation
Lifecycle segmentation is about crafting interactions based on where customers are in their journey with a brand.
Lifecycle segmentation isn’t just about selling ; it’s about building relationships. After a big purchase like furniture, sending care tips instead of another sales pitch shows customers that the brand cares about their experience beyond just the sale.
This approach helps brands avoid generic messaging that might alienate customers. By understanding the customer’s lifecycle stage, businesses can tailor their communications to meet specific needs, whether nurturing new relationships or rewarding long-term loyalty.
Potential data points :
- Purchase history
- Sign-up dates
Examples of effective lifecycle segmentation :
An online clothing store might send first-time buyers a discount code to encourage repeat purchases. On the other hand, if someone hasn’t shopped in months, they might get an email with “We miss you” messaging and a special deal to bring them back.
Predictive segmentation
Predictive segmentation uses past behaviour and preferences to understand or predict what customers might want next. Its real power lies in its ability to make customers feel understood without them having to ask for anything.
Potential data points :
- Purchase patterns
- Browsing history
- Interaction frequency
Examples of effective predictive segmentation :
Streaming platforms are great examples — they analyse what shows and genres users watch to recommend related content they might enjoy. Similarly, grocery delivery apps can analyse past orders to suggest when to reorder essentials like milk or bread.
B2B-specific : Firmographic segmentation
Beyond the eight main segmentation types, B2B marketers often use firmographic factors when segmenting their campaigns. It’s a way to segment campaigns that go beyond the considerations of the individual.
Potential data points :
- Annual revenue
- Number of employees
- Industry
- Geographic location (main office)
Example of effective firmographic segmentation :
Startups and well-established companies will not need the same solution, so segmenting leads by size is one of the most common and effective examples of B2B audience segmentation.
The difference here is that B2B campaigns involve more manual research. With an account-based marketing approach, you start by researching potential customers. Then, you separate the target audience into smaller segments (or even a one-to-one campaign).
Audience segmentation challenges (+ how to overcome them)
Below, we explore audience segmentation challenges organisations can face and practical ways to overcome them.
Data privacy
Regulations like GDPR and CCPA require businesses to handle customer data responsibly. Ignoring these rules can lead to hefty fines and harm a brand’s reputation. Customers are also more aware of and sensitive to how their data is used, making transparency essential.
Businesses should adopt clear data policies and provide opt-out options to build trust and demonstrate respect for user preferences.
Privacy-focused analytics tools can help businesses handle these requirements effectively. For example, Matomo allows businesses to anonymise user data and offers features that give users control over their tracking preferences.
Data quality
Inconsistent, outdated or duplicate data can result in irrelevant messaging that frustrates customers instead of engaging them.
This is why businesses should regularly audit their data sources for accuracy and completeness.
Integrate multiple data sources into a unified platform for a more in-depth customer view. Implement data cleansing processes to remove duplicates, outdated records, and errors.
Segment management
Managing too many segments can become overwhelming, especially for businesses with limited resources. Creating and maintaining numerous audience groups requires significant time and effort, which may not always be feasible.
Automated tools and analytics platforms can help. Matomo Segments can analyse reports on specific audience groups based on criteria such as visit patterns, interactions, campaign sources, ecommerce behaviour, demographics and technology usage for more targeted analysis.
Detailed reporting of each segment’s characteristics can further simplify the process. By prioritising high-impact segments — those that offer the best potential return on investment — businesses can focus their efforts where they matter most.
Behaviour shifts
Customer behaviour constantly evolves due to changing trends, new technology and shifting social and economic conditions.
Segmentation strategies that worked in the past can quickly become outdated.
Businesses need to monitor market trends and adjust their strategies accordingly. Flexibility is key here — segmentation should never be static.
For example, if a sudden spike in mobile traffic is detected, campaigns can be optimised for mobile-first users.
Tools and technologies that help
Here are some key segmentation tools to support your efforts :
- Analytics platforms : Get insights into audience behaviour with Matomo. Track user interactions, such as website visits, clicks and time spent on pages, to identify patterns and segment users based on their online activity.
- CRM systems : Utilize customer records to create meaningful segments based on characteristics like purchase history or engagement levels.
- Marketing automation platforms : Streamline personalised messages by automating emails, social media posts or SMS campaigns for specific audience segments.
- Consent management tools : Collect and manage user consent, implement transparent data tracking and provide users with opt-out options.
- Survey tools : Gather first-party data directly from customers.
- Social listening solutions : Monitor conversations and brand mentions across social media to gauge audience sentiment.
Start segmenting and analysing audiences more deeply with Matomo
Modern consumers expect to get relevant content, and segmentation can make this possible.
But doing so in a privacy-sensitive way is not always easy. Organisations need to adopt an approach that doesn’t break regulations while still allowing them to segment their audiences.
That’s where Matomo comes in. Matomo champions privacy compliance while offering comprehensive insights and segmentation capabilities. It provides features for privacy control, enables cookieless configurations, and supports compliance with GDPR and other regulations — all without compromising user privacy.
Take advantage of Matomo’s 21-day free trial to explore its capabilities firsthand — no credit card required.
-
A systematic approach to making Web Applications accessible
22 février 2012, par silviaWith the latest developments in HTML5 and the still fairly new ARIA (Accessible Rich Interface Applications) attributes introduced by the W3C WAI (Web Accessibility Initiative), browsers have now implemented many features that allow you to make your JavaScript-heavy Web applications accessible.
Since I began working on making a complex web application accessible just over a year ago, I discovered that there was no step-by-step guide to approaching the changes necessary for creating an accessible Web application. Therefore, many people believe that it is still hard, if not impossible, to make Web applications accessible. In fact, it can be approached systematically, as this article will describe.
This post is based on a talk that Alice Boxhall and I gave at the recent Linux.conf.au titled “Developing accessible Web apps – how hard can it be ?” (slides, video), which in turn was based on a Google Developer Day talk by Rachel Shearer (slides).
These talks, and this article, introduce a process that you can follow to make your Web applications accessible : each step will take you closer to having an application that can be accessed using a keyboard alone, and by users of screenreaders and other accessibility technology (AT).
The recommendations here only roughly conform to the requirements of WCAG (Web Content Accessibility Guidelines), which is the basis of legal accessibility requirements in many jurisdictions. The steps in this article may or may not be sufficient to meet a legal requirement. It is focused on the practical outcome of ensuring users with disabilities can use your Web application.
Step-by-step Approach
The steps to follow to make your Web apps accessible are as follows :
- Use native HTML tags wherever possible
- Make interactive elements keyboard accessible
- Provide extra markup for AT (accessibility technology)
If you are a total newcomer to accessibility, I highly recommend installing a screenreader and just trying to read/navigate some Web pages. On Windows you can install the free NVDA screenreader, on Mac you can activate the pre-installed VoiceOver screenreader, on Linux you can use Orca, and if you just want a browser plugin for Chrome try installing ChromeVox.
1. Use native HTML tags
As you implement your Web application with interactive controls, try to use as many native HTML tags as possible.
HTML5 provides a rich set of elements which can be used to both add functionality and provide semantic context to your page. HTML4 already included many useful interactive controls, like <a>, <button>, <input> and <select>, and semantic landmark elements like <h1>. HTML5 adds richer <input> controls, and a more sophisticated set of semantic markup elements like such as <time>, <progress>, <meter>, <nav>, <header>, <article> and <aside>. (Note : check browser support for browser support of the new tags).
Using as much of the rich HTML5 markup as possible means that you get all of the accessibility features which have been implemented in the browser for those elements, such as keyboard support, short-cut keys and accessibility metadata, for free. For generic tags you have to implement them completely from scratch.
What exactly do you miss out on when you use a generic tag such as <div> over a specific semantic one such as <button> ?
- Generic tags are not focusable. That means you cannot reach them through using the [tab] on the keyboard.
- You cannot activate them with the space bar or enter key or perform any other keyboard interaction that would be regarded as typical with such a control.
- Since the role that the control represents is not specified in code but is only exposed through your custom visual styling, screenreaders cannot express to their users what type of control it is, e.g. button or link.
- Neither can screenreaders add the control to the list of controls on the page that are of a certain type, e.g. to navigate to all headers of a certain level on the page.
- And finally you need to manually style the element in order for it to look distinctive compared to other elements on the page ; using a default control will allow the browser to provide the default style for the platform, which you can still override using CSS if you want.
Example :
Compare these two buttons. The first one is implemented using a <div> tag, the second one using a <button> tag. Try using a screenreader to experience the difference.
<style> .custombutton cursor : pointer ; border : 1px solid #000 ; background-color : #F6F6F6 ; display : inline-block ; padding : 2px 5px ; </style> <div class="custombutton" onclick="alert(’sent !’)"> Send </div>
<button onclick="alert(’sent !’)"> Send </button>
2. Make interactive elements keyboard accessible
Many sophisticated web applications have some interactive controls that just have no appropriate HTML tag equivalent. In this case, you will have had to build an interactive element with JavaScript and <div> and/or <span> tags and lots of custom styling. The good news is, it’s possible to make even these custom controls accessible, and as a side benefit you will also make your application smoother to use for power users.
The first thing you can do to test usability of your control, or your Web app, is to unplug the mouse and try to use only the [TAB] and [ENTER] keys to interact with your application.
Try the following :
- Can you reach all interactive elements with [TAB] ?
- Can you activate interactive elements with [ENTER] (or [SPACE]) ?
- Are the elements in the right tab order ?
- After interaction : is the right element in focus ?
- Is there a keyboard shortcut that activates the element (accesskey) ?
No ? Let’s fix it.
2.1. Reaching interactive elements
If you have an element on your page that cannot be reached with [TAB], put a @tabindex attribute on it.
Example :
Here we have a <span> tag that works as a link (don’t do this – it’s just a simple example). The first one cannot be reached using [TAB] but the second one has a tabindex and is thus part of the tab order of the HTML page.
(Note : since we experiment lots with the tabindex in this article, to avoid confusion, click on some text in this paragraph and then hit the [TAB] key to see where it goes next. The click will set your keyboard focus in the DOM.)
Click
<style> .customlink text-decoration : underline ; cursor : pointer ; </style> <span class="customlink" onclick="alert(’activated !’)"> Click </span>
Click <style> .customlink text-decoration : underline ; cursor : pointer ; </style> <span class="customlink" onclick="alert(’activated !’)" tabindex="0"> Click </span>
You set @tabindex=0 to add an element into the native tab order of the page, which is the DOM order.
2.2. Activating interactive elements
Next, you typically want to be able to use the [ENTER] and [SPACE] keys to activate your custom control. To do so, you will need to implement an onkeydown event handler. Note that the keyCode for [ENTER] is 13 and for [SPACE] is 32.
Example :
Let’s add this functionality to the <span> tag from before. Try tabbing to it and hit the [ENTER] or [SPACE] key.
Click <span class="customlink" onclick="alert(’activated !’)" tabindex="0"> Click </span>
<script><br />
function handlekey(event) {<br />
var target = event.target || event.srcElement;<br />
if (event.keyCode == 13 || event.keyCode == 32) { target.onclick(); }<br />
}<br />
</script>
Click<span class="customlink" onclick="alert(’activated !’)" tabindex="0" onkeydown="handlekey(event) ;"> Click </span> <script> function handlekey(event) var target = event.target || event.srcElement ; if (event.keyCode == 13 || event.keyCode == 32) target.onclick() ; </script>
Note that there are some controls that might need support for keys other than [tab] or [enter] to be able to use them from the keyboard alone, for example a custom list box, menu or slider should respond to arrow keys.
2.3. Elements in the right tab order
Have you tried tabbing to all the elements on your page that you care about ? If so, check if the order of tab stops seems right. The default order is given by the order in which interactive elements appear in the DOM. For example, if your page’s code has a right column that is coded before the main article, then the links in the right column will receive tab focus first before the links in the main article.
You could change this by re-ordering your DOM, but oftentimes this is not possible. So, instead give the elements that should be the first ones to receive tab focus a positive @tabindex. The tab access will start at the smallest non-zero @tabindex value. If multiple elements share the same @tabindex value, these controls receive tab focus in DOM order. After that, interactive elements and those with @tabindex=0 will receive tab focus in DOM order.
Example :
The one thing that always annoys me the most is if the tab order in forms that I am supposed to fill in is illogical. Here is an example where the first and last name are separated by the address because they are in a table. We could fix it by moving to a <div> based layout, but let’s use @tabindex to demonstrate the change.
Firstname :
Address :
Lastname :
City :
<table class="customtabs"> <tr> <td>Firstname : <input type="text" id="firstname"> </td> <td>Address : <input type="text" id="address"> </td> </tr> <tr> <td>Lastname : <input type="text" id="lastname"> </td> <td>City : <input type="text" id="city"> </td> </tr> </table>
Click here to test this form,
then [TAB] :Firstname :
Address :
Lastname :
City :
<table class="customtabs"> <tr> <td>Firstname : <input type="text" id="firstname" tabindex="10"> </td> <td>Address : <input type="text" id="address" tabindex="30"> </td> </tr> <tr> <td>Lastname : <input type="text" id="lastname" tabindex="20"> </td> <td>City : <input type="text" id="city" tabindex="40"> </td> </tr> </table>
Be very careful with using non-zero tabindex values. Since they change the tab order on the page, you may get side effects that you might not have intended, such as having to give other elements on the page a non-zero tabindex value to avoid skipping too many other elements as I would need to do here.
2.4. Focus on the right element
Some of the controls that you create may be rather complex and open elements on the page that were previously hidden. This is particularly the case for drop-downs, pop-ups, and menus in general. Oftentimes the hidden element is not defined in the DOM right after the interactive control, such that a [TAB] will not put your keyboard focus on the next element that you are interacting with.
The solution is to manage your keyboard focus from JavaScript using the .focus() method.
Example :
Here is a menu that is declared ahead of the menu button. If you tab onto the button and hit enter, the menu is revealed. But your tab focus is still on the menu button, so your next [TAB] will take you somewhere else. We fix it by setting the focus on the first menu item after opening the menu.
<script><br />
function displayMenu(value) {<br />
document.getElementById("custommenu").style.display=value;<br />
}<br />
</script><div id="custommenu" style="display:none ;"> <button id="item1" onclick="displayMenu(’none’) ;">Menu item1</button> <button id="item2" onclick="displayMenu(’none’) ;">Menu item2</button> </div> <button onclick="displayMenu(’block’) ;">Menu</button> <script> function displayMenu(value) document.getElementById("custommenu").style.display=value ; </script>
<script><br />
function displayMenu2(value) {<br />
document.getElementById("custommenu2").style.display=value;<br />
document.getElementById("item1").focus();<br />
}<br />
</script><div id="custommenu" style="display:none ;"> <button id="item1" onclick="displayMenu(’none’) ;">Menu item1</button> <button id="item2" onclick="displayMenu(’none’) ;">Menu item2</button> </div> <button onclick="displayMenu(’block’) ;">Menu</button> <script> function displayMenu(value) document.getElementById("custommenu").style.display=value ; document.getElementById("item1").focus() ; </script>
You will notice that there are still some things you can improve on here. For example, after you close the menu again with one of the menu items, the focus does not move back onto the menu button.
Also, after opening the menu, you may prefer not to move the focus onto the first menu item but rather just onto the menu <div>. You can do so by giving that div a @tabindex and then calling .focus() on it. If you do not want to make the div part of the normal tabbing order, just give it a @tabindex=-1 value. This will allow your div to receive focus from script, but be exempt from accidental tabbing onto (though usually you just want to use @tabindex=0).
Bonus : If you want to help keyboard users even more, you can also put outlines on the element that is currently in focus using CSS”s outline property. If you want to avoid the outlines for mouse users, you can dynamically add a class that removes the outline in mouseover events but leaves it for :focus.
2.5. Provide sensible keyboard shortcuts
At this stage your application is actually keyboard accessible. Congratulations !
However, it’s still not very efficient : like power-users, screenreader users love keyboard shortcuts : can you imagine if you were forced to tab through an entire page, or navigate back to a menu tree at the top of the page, to reach each control you were interested in ? And, obviously, anything which makes navigating the app via the keyboard more efficient for screenreader users will benefit all power users as well, like the ubiquitous keyboard shortcuts for cut, copy and paste.
HTML4 introduced so-called accesskeys for this. In HTML5 @accesskey is now allowed on all elements.
The @accesskey attribute takes the value of a keyboard key (e.g. @accesskey="x") and is activated through platform- and browser-specific activation keys. For example, on the Mac it’s generally the [Ctrl] key, in IE it’ the [Alt] key, in Firefox on Windows [Shift]-[Alt], and in Opera on Windows [Shift]-[ESC]. You press the activation key and the accesskey together which either activates or focuses the element with the @accesskey attribute.
Example :
<script><br />
var button = document.getElementById('accessbutton');<br />
if (button.accessKeyLabel) {<br />
button.innerHTML += ' (' + button.accessKeyLabel + ')';<br />
}<br />
</script><button id="accessbutton" onclick="alert(’sent !’)" accesskey="e"> Send </button> <script> var button = document.getElementById(’accessbutton’) ; if (button.accessKeyLabel) button.innerHTML += ’ (’ + button.accessKeyLabel + ’)’ ; </script>
Now, the idea behind this is clever, but the execution is pretty poor. Firstly, the different activation keys between different platforms and browsers make it really hard for people to get used to the accesskeys. Secondly, the key combinations can conflict with browser and screenreader shortcut keys, the first of which will render browser shortcuts unusable and the second will effectively remove the accesskeys.
In the end it is up to the Web application developer whether to use the accesskey attribute or whether to implement explicit shortcut keys for the application through key event handlers on the window object. In either case, make sure to provide a help list for your shortcut keys.
Also note that a page with a really good hierarchical heading layout and use of ARIA landmarks can help to eliminate the need for accesskeys to jump around the page, since there are typically default navigations available in screen readers to jump directly to headings, hyperlinks, and ARIA landmarks.
3. Provide markup for AT
Having made the application keyboard accessible also has advantages for screenreaders, since they can now reach the controls individually and activate them. So, next we will use a screenreader and close our eyes to find out where we only provide visual cues to understand the necessary interaction.
Here are some of the issues to consider :
- Role may need to get identified
- States may need to be kept track of
- Properties may need to be made explicit
- Labels may need to be provided for elements
This is where the W3C’s ARIA (Accessible Rich Internet Applications) standard comes in. ARIA attributes provide semantic information to screen readers and other AT that is otherwise conveyed only visually.
Note that using ARIA does not automatically implement the standard widget behavior – you’ll still need to add focus management, keyboard navigation, and change aria attribute values in script.
3.1. ARIA roles
After implementing a custom interactive widget, you need to add a @role attribute to indicate what type of controls it is, e.g. that it is playing the role of a standard tag such as a button.
Example :
This menu button is implemented as a <div>, but with a role of “button” it is announced as a button by a screenreader.
<div tabindex="0" role="button">Menu</div>
ARIA roles also describe composite controls that do not have a native HTML equivalent.
Example :
This menu with menu items is implemented as a set of <div> tags, but with a role of “menu” and “menuitem” items.
<div role="menu"> <div tabindex="0" role="menuitem">Cut</div> <div tabindex="0" role="menuitem">Copy</div> <div tabindex="0" role="menuitem">Paste</div> </div>
3.2. ARIA states
Some interactive controls represent different states, e.g. a checkbox can be checked or unchecked, or a menu can be expanded or collapsed.
Example :
The following menu has states on the menu items, which are here not just used to give an aural indication through the screenreader, but also a visual one through CSS.
<style> .custombutton[aria-checked=true]:before content : "\2713 " ; </style> <div role="menu"> <div tabindex="0" role="menuitem" aria-checked="true">Left</div> <div tabindex="0" role="menuitem" aria-checked="false">Center</div> <div tabindex="0" role="menuitem" aria-checked="false">Right</div> </div>
3.3. ARIA properties
Some of the functionality of interactive controls cannot be captured by the role attribute alone. We have ARIA properties to add features that the screenreader needs to announce, such as aria-label, aria-haspopup, aria-activedescendant, or aria-live.
Example :
The following drop-down menu uses aria-haspopup to tell the screenreader that there is a popup hidden behind the menu button together with an ARIA state of aria-expanded to track whether it’s open or closed.
<script><br />
var button = document.getElementById("button");<br />
var menu = document.getElementById("menu");<br />
var items = document.getElementsByClassName("menuitem");<br />
var focused = 0;<br />
function showMenu(evt) {<br />
evt.stopPropagation();<br />
menu.style.visibility = 'visible';<br />
button.setAttribute('aria-expanded','true');<br />
focused = getSelected();<br />
items[focused].focus();<br />
}<br />
function hideMenu(evt) {<br />
evt.stopPropagation();<br />
menu.style.visibility = 'hidden';<br />
button.setAttribute('aria-expanded','false');<br />
button.focus();<br />
}<br />
function getSelected() {<br />
for (var i=0; i < items.length; i++) {<br />
if (items[i].getAttribute('aria-checked') == 'true') {<br />
return i;<br />
}<br />
}<br />
}<br />
function setSelected(elem) {<br />
var curSelected = getSelected();<br />
items[curSelected].setAttribute('aria-checked', 'false');<br />
elem.setAttribute('aria-checked', 'true');<br />
}<br />
function selectItem(evt) {<br />
setSelected(evt.target);<br />
hideMenu(evt);<br />
}<br />
function getPrevItem(index) {<br />
var prev = index - 1;<br />
if (prev < 0) {<br />
prev = items.length - 1;<br />
}<br />
return prev;<br />
}<br />
function getNextItem(index) {<br />
var next = index + 1;<br />
if (next == items.length) {<br />
next = 0;<br />
}<br />
return next;<br />
}<br />
function handleButtonKeys(evt) {<br />
evt.stopPropagation();<br />
var key = evt.keyCode;<br />
switch(key) {<br />
case (13): /* ENTER */<br />
case (32): /* SPACE */<br />
showMenu(evt);<br />
default:<br />
}<br />
}<br />
function handleMenuKeys(evt) {<br />
evt.stopPropagation();<br />
var key = evt.keyCode;<br />
switch(key) {<br />
case (38): /* UP */<br />
focused = getPrevItem(focused);<br />
items[focused].focus();<br />
break;<br />
case (40): /* DOWN */<br />
focused = getNextItem(focused);<br />
items[focused].focus();<br />
break;<br />
case (13): /* ENTER */<br />
case (32): /* SPACE */<br />
setSelected(evt.target);<br />
hideMenu(evt);<br />
break;<br />
case (27): /* ESC */<br />
hideMenu(evt);<br />
break;<br />
default:<br />
}<br />
}<br />
button.addEventListener('click', showMenu, false);<br />
button.addEventListener('keydown', handleButtonKeys, false);<br />
for (var i = 0; i < items.length; i++) {<br />
items[i].addEventListener('click', selectItem, false);<br />
items[i].addEventListener('keydown', handleMenuKeys, false);<br />
}<br />
</script><div class="custombutton" id="button" tabindex="0" role="button" aria-expanded="false" aria-haspopup="true"> <span>Justify</span> </div> <div role="menu" class="menu" id="menu" style="display : none ;"> <div tabindex="0" role="menuitem" class="menuitem" aria-checked="true"> Left </div> <div tabindex="0" role="menuitem" class="menuitem" aria-checked="false"> Center </div> <div tabindex="0" role="menuitem" class="menuitem" aria-checked="false"> Right </div> </div> [CSS and JavaScript for example omitted]
3.4. Labelling
The main issue that people know about accessibility seems to be that they have to put alt text onto images. This is only one means to provide labels to screenreaders for page content. Labels are short informative pieces of text that provide a name to a control.
There are actually several ways of providing labels for controls :
- on img elements use @alt
- on input elements use the label element
- use @aria-labelledby if there is another element that contains the label
- use @title if you also want a label to be used as a tooltip
- otherwise use @aria-label
I’ll provide examples for the first two use cases - the other use cases are simple to deduce.
Example :
The following two images show the rough concept for providing alt text for images : images that provide information should be transcribed, images that are just decorative should receive an empty @alt attribute.
Image by Noah Sussman<img src="texture.jpg" alt=""> <img src="lolcat.jpg" alt="shocked lolcat titled ’HTML cannot do that !"> <img src="texture.jpg" alt="">
When marking up decorative images with an empty @alt attribute, the image is actually completely removed from the accessibility tree and does not confuse the blind user. This is a desired effect, so do remember to mark up all your images with @alt attributes, even those that don’t contain anything of interest to AT.
Example :
In the example form above in Section 2.3, when tabbing directly on the input elements, the screen reader will only say "edit text" without announcing what meaning that text has. That’s not very useful. So let’s introduce a label element for the input elements. We’ll also add checkboxes with a label.
<label>Doctor title :</label> <input type="checkbox" id="doctor"/> <label>Firstname :</label> <input type="text" id="firstname2"/>
<label for="lastname2">Lastname :</label>
<input type="text" id="lastname2"/><label>Address :
<input type="text" id="address2">
</label>
<label for="city2">City :
<input type="text" id="city2">
</label>
<label for="remember">Remember me :</label>
<input type="checkbox" id="remember">In this example we use several different approaches to show what a different it makes to use the <label> element to mark up input boxes.
The first two fields just have a <label> element next to a <input> element. When using a screenreader you will not notice a difference between this and not using the <label> element because there is no connection between the <label> and the <input> element.
In the third field we use the @for attribute to create that link. Now the input field isn’t just announced as "edit text", but rather as "Lastname edit text", which is much more useful. Also, the screenreader can now skip the labels and get straight on the input element.
In the fourth and fifth field we actually encapsulate the <input> element inside the <label> element, thus avoiding the need for a @for attribute, though it doesn’t hurt to explicity add it.
Finally we look at the checkbox. By including a referenced <label> element with the checkbox, we change the screenreaders announcement from just "checkbox not checked" to "Remember me checkbox not checked". Also notice that the click target now includes the label, making the checkbox not only more usable to screenreaders, but also for mouse users.
4. Conclusions
This article introduced a process that you can follow to make your Web applications accessible. As you do that, you will noticed that there are other things that you may need to do in order to give the best experience to a power user on a keyboard, a blind user using a screenreader, or a vision-impaired user using a screen magnifier. But once you’ve made a start, you will notice that it’s not all black magic and a lot can be achieved with just a little markup.
You will find more markup in the WAI ARIA specification and many more resources at Mozilla’s ARIA portal. Now go and change the world !
Many thanks to Alice Boxhall and Dominic Mazzoni for their proof-reading and suggested changes that really helped improve the article !