Getting Started
Understanding User Agents and Referers

Requesting an image begins an interaction between the browser and the web page the image was viewed on, exchanging data between one another. Two essential elements exchanged in the request headers are user-agent and referer information.

What is a User-Agent?

When a browser or device makes a request, a string of text is sent, known as a user-agent. The user-agent helps identify the application, operating system, and device type. With this information, websites can deliver optimized content for the given platform.

Example of a user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36

This user-agent tells us the following:

  • Browser: Chrome 93
  • Operating System: Windows 10, 64-bit
  • Rendering Engine: AppleWebKit (used by Chrome and Safari)

Importance of User-Agents

User-agents are important for content optimization, analytics, and security. imgix logs the user-agent when a request to an asset is made. The information can be analyzed to understand where your traffic is coming from (desktop versus mobile). Having user-agent information may also indicate suspicious activity from automated bots or programs.

What is a Referer?

A referer is sent with the HTTP header requests like a user-agent. This request indicates the URL from which it originated, which allows websites to understand where traffic is coming from.

For example, if you click on a link to [www.imgix.com (opens in a new tab)] from [www.google.com (opens in a new tab)], the request will include the following header:

  • Referer: https://www.google.com

Importance of Referers

Referers are essential for analytics, SEO, and security. With imgix, when a request is sent to an image, we can understand the page from which the image was requested. This information can indicate the traffic source and how well marketing campaigns may be. In some cases, we may see where an image is being used unintendedly.

Why Might Referer or User-Agent Information Be Empty?

imgix can provide analytics and reports for image requests. Within these requests, referer or user-agent information can be empty. This can happen intentionally by the web developer or due to security issues. Sometimes, when images are requested, no referer information is included. This can happen because of certain privacy settings or browser configurations that control whether websites can learn where the image request came from.

For example, some settings may stop referer information from being sent when you move from a secure (HTTPS) to an insecure (HTTP) site or only send referer details when staying on the same domain. An example value would be “noreferer”, where the request would not include the referer information. These settings are in place to help protect privacy by preventing websites from tracking user activity across different pages or sites.

In private browsing or incognito mode, some browsers also hide referer information to keep users’ browsing history private, ensuring that websites can’t track where the requests for images come from across different sessions.

When browsers or privacy-focused extensions block the User-Agent header, they do so to prevent websites from gathering details about the device or browser used to request an image. This helps protect user privacy by limiting the amount of data websites can use to track or identify users.

In some cases, automated tools or bots used for making image requests, such as those for data scraping or automated testing, might not include a user-agent. These tools may not need to reveal the identity of the bot or the device requesting the image, making the request anonymous.