
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Sat, 04 Apr 2026 13:39:01 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Announcing the Cloudflare Browser Developer Program]]></title>
            <link>https://blog.cloudflare.com/announcing-the-cloudflare-browser-developer-program/</link>
            <pubDate>Mon, 18 Aug 2025 14:00:00 GMT</pubDate>
            <description><![CDATA[ Announcing the Browser Developer Program: Cloudflare’s new collaborative program to help shape Cloudflare challenges that work seamlessly with your browser. Join us today! ]]></description>
            <content:encoded><![CDATA[ <p>Today, we are announcing Cloudflare’s <b>Browser Developer Program</b>, a collaborative initiative to strengthen partnership between Cloudflare and browser development teams.</p><p>Browser developers can apply to join <a href="https://forms.gle/fx8odhNNeqFELqVB9"><u>here</u></a>. </p><p>At Cloudflare, we aim to help build a better Internet. One way we achieve this is by providing website owners with the tools to detect and block unwanted traffic from bots through Cloudflare <a href="https://developers.cloudflare.com/cloudflare-challenges/"><u>Challenges</u></a> or <a href="https://developers.cloudflare.com/turnstile/"><u>Turnstile</u></a>. As both bots and our detection systems become more sophisticated, the security checks required to validate human traffic become more complicated. While we aim to strike the right balance, we recognize these security measures can sometimes cause issues for legitimate browsers and their users.</p>
    <div>
      <h2>Building a better web together</h2>
      <a href="#building-a-better-web-together">
        
      </a>
    </div>
    <p>A core objective of the program is to provide a space for intentional collaboration where we can work directly with browser developers to ensure that both accessibility and security can co-exist. We aim to support the evolving browser landscape, while upholding our responsibility to our customers to deliver the best security products. This program provides a dedicated channel for browser teams to share feedback, report issues, and help ensure that Cloudflare’s Challenges and Turnstile work seamlessly with all browsers.</p>
    <div>
      <h2>What the program includes</h2>
      <a href="#what-the-program-includes">
        
      </a>
    </div>
    <p>Browser developers in the program will benefit from:</p><ul><li><p>A two-way communication channel to Cloudflare’s team dedicated to addressing browser-specific concerns, feedback, and issues.</p></li><li><p>Best practices for building and testing against Cloudflare Challenges and Turnstile.</p></li><li><p>A private community forum for updates, questions, and discussion between browser developers and Cloudflare engineers. </p></li><li><p>Early visibility into updates or changes to that may impact how your browser handles Cloudflare Challenges.</p></li><li><p>(If applicable) Testing integration where we will incorporate your browser into our testing pipeline and monitor its performance with our releases.</p></li></ul><p>This program is designed as a partnership where Cloudflare will, with our best effort, ensure our security products work properly with all browsers, while giving browser developers a voice in how these systems evolve. As an output of this program, we expect to publish clear browser requirements to run Cloudflare Challenges while striking the balance between openness and security. </p><p>For end users browsing the web, we continue to support a wide range of <a href="https://developers.cloudflare.com/cloudflare-challenges/reference/supported-browsers/"><u>browsers</u></a>. We will continue to update this list based on the insights and collaborations from the Browser Developer Program. We are also committed to ensuring our <a href="https://developers.cloudflare.com/cloudflare-challenges/challenge-types/challenge-pages/"><u>Challenge interstitial pages</u></a> and <a href="https://developers.cloudflare.com/turnstile/"><u>Turnstile</u></a> provide clear, actionable UI/UX for any error or failed states, making it easier for you to understand and resolve issues you may encounter. </p>
    <div>
      <h2>How to apply</h2>
      <a href="#how-to-apply">
        
      </a>
    </div>
    <p>If you are working on a browser and want to ensure your users have a seamless experience with Cloudflare-protected websites, we encourage you to apply <a href="https://forms.gle/fx8odhNNeqFELqVB9"><u>here</u></a>. </p><p>We’ll ask for basic information about your project and ask you to sign our Browser Developer Program Agreement.  In addition, we expect participants to adhere to our Community Code of Conduct and commit to constructive engagement.</p><p>Once you’re accepted, you’ll be invited to a private space in the Cloudflare Community where you can engage directly with our team. </p>
    <div>
      <h2>Why is this important?</h2>
      <a href="#why-is-this-important">
        
      </a>
    </div>
    <p>Cloudflare <a href="https://developers.cloudflare.com/cloudflare-challenges/"><u>Challenges</u></a>, a security mechanism to verify whether a visitor is a human or a bot, serve a wide variety of browsers in the world today. Chrome leads with 68.0%, Safari at 8.7%, Firefox at 6.3%, Edge at 4.8%, and Opera at 6.2%. However, the very long tail of browsers that collectively make up the remaining traffic, each representing less than 1% individually but together painting a picture of an incredibly diverse web ecosystem.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7HlxV6qe25cwxRipsbap0V/3859c5065e51e3f8f37b4b18fef5cee8/BLOG-2804_2.png" />
          </figure><p><sub><i>Browser traffic distribution, with 100+ browsers comprising the 'Other' category</i></sub></p><p>This diversity spans a wide range of environments, each with unique constraints and capabilities:</p><ul><li><p>Emerging and experimental browsers pushing the boundaries of web technology</p></li><li><p>Privacy-focused browsers such as DuckDuckGo that prioritize user data protection</p></li><li><p>Embedded browsers inside social media apps like Facebook, Instagram, and TikTok</p></li><li><p>WebViews used by mobile applications</p></li><li><p>Gaming and VR browsers such as Oculus for headsets and gaming consoles</p></li><li><p>Smart device browsers built into classroom displays and home appliances</p></li></ul><p>Supporting this level of diversity poses real engineering challenges. Many of these browsers deviate from standard assumptions. Some lack full support for modern Web APIs, others operate under more stringent data privacy policies, and some are optimized for environments where our script to verify visitors may be hindered or blocked from running properly. These browsers are not bad or malicious. But their behavior may fall outside the typical patterns observed in mainstream browsers, which can lead to problematic or failed Challenge flows which we would like to avoid.</p><p>From an engineering perspective, our job is to strike a difficult balance. If our logic is too rigid that it expects only the behaviors of the majority, we risk excluding legitimate users on less conventional platforms. But if we relax our standards too much, we increase the attack surface for abuse. We cannot overfit to the top 5 browsers, nor can we afford to treat all clients as equal in capability or trustworthiness.</p><p>The Browser Developer Program is one way to close this gap. By working directly with browser teams, especially those building for niche or emerging environments, we can better understand the constraints they operate under and collaborate to make each of our systems more compatible and resilient. </p>
    <div>
      <h2>Join us!</h2>
      <a href="#join-us">
        
      </a>
    </div>
    <p>This program is free to join, and is open to any browser developer, no matter the size or the lifecycle stage. Our goal is to listen, learn, and collaborate with browser developers to create a better experience for everyone. </p><p>We believe this program will ultimately benefit end users the most. By joining this program, you will help us build solutions that prioritize both the security needs of businesses as well as the diverse ways people access the Internet. </p><p>We look forward to your participation!</p> ]]></content:encoded>
            <category><![CDATA[Turnstile]]></category>
            <category><![CDATA[Bots]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Developers]]></category>
            <category><![CDATA[Developer Platform]]></category>
            <category><![CDATA[Challenge Page]]></category>
            <guid isPermaLink="false">6VcasIRuXCvJ8K2tqUHmkG</guid>
            <dc:creator>Sally Lee</dc:creator>
            <dc:creator>Oliver Payne</dc:creator>
        </item>
        <item>
            <title><![CDATA[Upgraded Turnstile Analytics enable deeper insights, faster investigations, and improved security]]></title>
            <link>https://blog.cloudflare.com/upgraded-turnstile-analytics-enable-deeper-insights-faster-investigations/</link>
            <pubDate>Tue, 18 Mar 2025 13:00:00 GMT</pubDate>
            <description><![CDATA[ Introducing new Turnstile Analytics: Gain insight into your visitor traffic, bot behavior patterns, traffic anomalies, and attack attributes. ]]></description>
            <content:encoded><![CDATA[ <p>Attackers are increasingly using more sophisticated methods to not just brute force their way into your sites but also simulate real user behavior for targeted harmful activity like account takeovers, credential stuffing, fake account creation, <a href="https://www.cloudflare.com/learning/ai/how-to-prevent-web-scraping/">content scraping</a>, and fraudulent transactions. They are no longer trying to simply take your website down or gain access to it, but rather cause actual business harm. There is also the increasing complexity added by attackers rotating IP addresses, routing through proxies, and using VPNs. In this evolving security landscape, meaningful analytics matter. Many traditional CAPTCHA solutions provide simplistic pass or fail trends on challenges without insights into traffic patterns or behavior. Cloudflare Turnstile aims to equip you with more than just basic trends, so you can make informed decisions and stay ahead of the attackers. </p><p>We are excited to introduce a major upgrade to <a href="https://developers.cloudflare.com/turnstile/turnstile-analytics/"><u>Turnstile Analytics</u></a>. With these upgraded analytics, you can identify harder-to-detect bots faster, and fine-tune your bot security posture with less manual log analysis than before. <a href="https://developers.cloudflare.com/turnstile/"><u>Turnstile</u></a>, our privacy-first <a href="https://www.cloudflare.com/learning/bots/how-captchas-work/"><u>CAPTCHA</u></a> alternative, has been helping you protect your applications from automated abuse while ensuring a seamless experience for legitimate users. Now, using enhanced analytics, you can gain deeper insights into your visitor traffic, challenge effectiveness, and potential security threats. </p><p>Previously, Turnstile users had limited visibility into what types of bots were being blocked, what specific characteristics were exhibited by bots that were attacking your website, and what identifiable behavior they had. Customers had to manually sift through limited analytics, correlate <a href="https://developers.cloudflare.com/turnstile/get-started/server-side-validation/"><u>Siteverify API</u></a> responses, and cross-reference multiple sources to identify trends. The previous Turnstile analytics dashboard made it difficult to get a bird's eye view of Turnstile efficacy, identify any patterns of abuse, and drill down on the specifics of an attack to create additional rules and safeguards. </p><p>The new Turnstile Analytics surfaces all of this information in one place, making it easier than before to assess your visitor traffic patterns through Turnstile and take immediate action against suspicious activity.</p>
    <div>
      <h3>What’s new with Turnstile Analytics?</h3>
      <a href="#whats-new-with-turnstile-analytics">
        
      </a>
    </div>
    <p>The main motivation behind this release is to provide actionable insights that further strengthen the layers of protection and to give customers the ability to dissect visitor traffic by the most relevant attributes, so that identifying bot behavior patterns becomes easier. New features of Turnstile Analytics include: </p>
    <div>
      <h4>Top statistics </h4>
      <a href="#top-statistics">
        
      </a>
    </div>
    <p>When you click into widget analytics under Turnstile in the Cloudflare Dashboard, you now have enhanced visibility of TopN statistics, and granular views of your traffic. The new TopN section is where you can view the top statistics of attributes such as hostname, <a href="https://www.cloudflare.com/learning/network-layer/what-is-an-autonomous-system/"><u>autonomous system (ASN)</u></a>, user agent, browser, source IP address, country, and OS. This allows customers to analyze traffic at a more granular level and detect potential anomalies or patterns. You can analyze which browsers, user agents, ASNs, and locations generated the most failed challenges, making it easier to detect bot behavior patterns and anomalies in your visitor traffic. Suspicious IP addresses that have a high challenge failure rate can be proactively mitigated through additional security measures. For instance, if you have WAF custom rules in place based on suspicious IP addresses, you can in turn adjust your WAF custom rules based on the trends you see in Turnstile, strengthening your other layers of security even further.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/51u7UF1W6ud6amSeP7c41N/d4a6d17ddc2a7cde024100a308449520/1.png" />
          </figure><p><sup><i>TopN section of Turnstile Analytics</i></sup></p>
    <div>
      <h4>Challenge outcomes</h4>
      <a href="#challenge-outcomes">
        
      </a>
    </div>
    <p>When a visitor encounters Turnstile, it issues a challenge to assess whether the visitor is a human or a bot, based on various signals. The <a href="https://developers.cloudflare.com/turnstile/turnstile-analytics/challenge-outcomes/"><u>Challenge outcomes</u></a> section helps you evaluate what portion of your traffic is likely human or likely bots.</p><p>The ability to easily monitor the effectiveness of Turnstile by looking at trends of Likely Human and Likely Bot metrics is important for peace of mind, knowing that the bots are being blocked and Turnstile is protecting your sites. But it’s also important to track changes in bot activity over time by monitoring challenge success and failure trends and across different attributes. You can detect anomalies in your traffic pattern and solve rates. For example, a sudden drop in solve rate overlaid with a surge in challenge attempts may indicate an attack. It is crucial to monitor bot behaviors and attacks that may be specific to your industry or to your business through Turnstile Analytics and correlate them with your internal security logs to keep your security rules up to date, to easily investigate any attacks, and to find areas of vulnerability. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6vAzZrKNrLNzU6jTFoXoDU/43ab17dcd11fe8e972caa838bfd83de0/2.png" />
          </figure><p><sup><i>Challenge outcomes section of Turnstile Analytics</i></sup></p>
    <div>
      <h4>Solve rates</h4>
      <a href="#solve-rates">
        
      </a>
    </div>
    <p>When the visitor successfully solves the challenge, the <a href="https://developers.cloudflare.com/turnstile/turnstile-analytics/challenge-outcomes/#solve-rates"><u>Solve rates</u></a> section shows how the visitors have solved the challenge. Solve rates can be broken down into <a href="https://developers.cloudflare.com/turnstile/turnstile-analytics/challenge-outcomes/#metrics-1"><u>interactive solves, non-interactive solves, and pre-clearance solves</u></a>. If you are using the <a href="https://developers.cloudflare.com/turnstile/concepts/widget/#widget-types"><u>managed mode</u></a>, for example, you can see how many of your visitors required interaction with the widget and were prompted to check the box for Turnstile to verify that they are human. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1495UrrH51QNwWf0kpwO34/842d72c1f1f39789d5e0e0395f677e9a/3.png" />
          </figure><p><sup><i>Solve rates section of Turnstile Analytics</i></sup></p>
    <div>
      <h4>Token validations</h4>
      <a href="#token-validations">
        
      </a>
    </div>
    <p>After a visitor successfully completes a Turnstile challenge, a token is generated that must be validated via the Siteverify API. The API response provides the ultimate outcome of our bot determination. Only rendering the widget on the client side without calling the Siteverify API for token validation is an incomplete implementation of Turnstile, and your site will not be protected. The Turnstile token that is returned from the challenge stage <a href="https://developers.cloudflare.com/turnstile/turnstile-analytics/token-validation/"><u>must be validated</u></a> via the Siteverify API as we check if the token is valid, whether it has been redeemed already (a single token can only be redeemed once), and whether it has expired. 
</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1GTzkvLjawlIGuwJo5G8UY/b79a50382764dee65861923a705e34d5/4.png" />
          </figure><p><sup><i>Token validation section of Turnstile Analytics</i></sup></p>
    <div>
      <h3>Let’s walk through a real world example</h3>
      <a href="#lets-walk-through-a-real-world-example">
        
      </a>
    </div>
    <p>Common use cases of Turnstile include protecting login and sign up pages from credential stuffing, account takeover, and fraudulent account creation attacks. Let’s walk through how you can best set up Turnstile on your login pages and interpret your traffic with the new Turnstile analytics. </p><p>You can set up two separate widgets for your login and sign up page, or you can set up one widget and use the '<a href="https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/#configurations"><u>action</u></a>' field to distinguish traffic between these pages. The ‘<a href="https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/#configurations"><u>cData</u></a>’ field can be used to pass along custom data to keep track of each individual attempt. This field is useful to track any pertinent information from your business logic such as account ID, session ID, etc. In this case, let’s assume we are passing along a session ID along with the login attempt. This is helpful if you are trying to protect and monitor against account takeover attacks or credential stuffing attacks. cData is a custom data field that is not stored in Cloudflare systems at any time. </p>
    <div>
      <h4>Rendering the Turnstile widget</h4>
      <a href="#rendering-the-turnstile-widget">
        
      </a>
    </div>
    <p>To place the Turnstile widget on your login page: </p>
            <pre><code>&lt;script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer&gt;&lt;/script&gt;
&lt;form action="/login" method="POST"&gt;
  &lt;div class="cf-turnstile" data-sitekey="your-site-key" data-action="login" data-cdata=”session123”&gt;&lt;/div&gt;
  &lt;input type="submit" value="Log in"&gt;
&lt;/form&gt;</code></pre>
            <p>To place the Turnstile widget on your signup page: </p>
            <pre><code>&lt;form action="/signup" method="POST"&gt;
  &lt;div class="cf-turnstile" data-sitekey="your-site-key" data-action="signup"&gt;&lt;/div&gt;
  &lt;input type="submit" value="Sign up"&gt;
&lt;/form&gt;</code></pre>
            
    <div>
      <h4>Validating the Turnstile token with the Siteverify API </h4>
      <a href="#validating-the-turnstile-token-with-the-siteverify-api">
        
      </a>
    </div>
    <p>At this point, you have placed the Turnstile widget in your login page. When a visitor visits this page, a Turnstile challenge will be issued and when the visitor completes the challenge, you will receive a Turnstile token that contains the outcome of the challenge. This must be validated via the Siteverify API like below: </p>
            <pre><code>// This is the demo secret key. 
// In production, we recommend you store your secret key(s) safely.
const SECRET_KEY = "1x0000000000000000000000000000000AA";

async function handlePost(request) {
  const body = await request.formData();
  // Turnstile injects a token in "cf-turnstile-response".
  const token = body.get("cf-turnstile-response");
  const ip = request.headers.get("CF-Connecting-IP");

  // Validate the token by calling the
  // "/Siteverify" API endpoint.
  let formData = new FormData();
  formData.append("secret", SECRET_KEY);
  formData.append("response", token);
  formData.append("remoteip", ip);

  const url = "https://challenges.cloudflare.com/turnstile/v0/siteverify";
  const result = await fetch(url, {
    body: formData,
    method: "POST",
  });

  const outcome = await result.json();
  if (outcome.success) {
    // happy path: let the visitor continue with login/signup
  } else {
    // option 1: custom error page directing the visitor to reach out to support
    // option 2: same as happy path but flag as potential bot
  }
}</code></pre>
            <p>As you can see in the code example above, you can control the visitor experience based on the Siteverify outcome. In the case where Siteverify API said the token is valid, it’s straightforward — let the visitor continue to log in and sign up. This can be monitored by the <b>Valid tokens</b> metric in the Token validation section in the new Turnstile Analytics. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3WN26OmbvqbbvBwXTk3Nxw/76cdf8f9d9376932733ea4c4fb6841b8/5.png" />
          </figure><p>Example Invalid Token Siteverify Outcome: </p>
            <pre><code>{
  "success": false,
  "challenge_ts": "2025-02-28T15:14:30.096Z",
  "hostname": "mybusiness.com",
  "error-codes": [],
  "action": "login",
  "cdata": "account123",
  "metadata":{
    "ephemeral_id": "x:9f78e0ed210960d7693b167e"
  }
}</code></pre>
            
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3hUZNIISTbFGqT0NYKMEhb/08bcd2f33de6a404faa71ca0c809a47e/6.png" />
          </figure><p>If Siteverify returns <code>"success": false</code>, this means that the token was invalid and Turnstile determined the visitor to be a bot. In this case, you have control over what you want the experience to be, such as redirecting the user to a custom error page where they can reach out to support.  </p><p>You can also flag that session (in this case, “session123”) as suspicious and require the account owner to take action. You can implement the UI so that it seems like the bot was successful in logging in to an account, but block any important actions, such as account changes or purchases. Likewise, you can alert the account owner that there has been a suspicious login attempt. </p><p>Turnstile is a building block to help you build out your security defenses, and you can design your logic to fit your priorities across UI, UX, and security. </p>
    <div>
      <h4>Interpreting login page analytics</h4>
      <a href="#interpreting-login-page-analytics">
        
      </a>
    </div>
    <p>The very first thing to monitor is the Top Statistics section to look out for any anomalous traffic characteristics in the “countries”, “source ASN”, and “source user agents” metrics. By seeing the traffic distribution, you can have a better understanding of your visitors and potentially spot any anomalies. At this point, you can also take a look at “Source browsers”, “Source OS”, and “Countries” to see if that aligns with your visitor demographics. If you have a list of suspicious IP addresses that you maintain, you can cross-reference them to see their success and failure rates. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4bUtPmM4FbqN9Azh6n43fW/a9eff878603fa095a378697962cec919/7.png" />
          </figure><p><i>Example TopN Section </i></p><p>Let’s say you suspect there has been a credential stuffing attack where bots were brute forcing their way into accounts. Below is mock data of what your analytics may look like where the time window is zoomed into the time of the attack. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3IMvwPeDOiXocgc8TMmgxk/c60394dc83f456a5f00b60e40c2dd196/8.png" />
          </figure><p><i>Example Challenge outcomes section </i></p><p>You can see that time period where the number of challenges unsolved started spiking and the “likely bot” metric shot up. This shows an increase in bot traffic, indicating an attack. However, you can also see that Turnstile was able to catch these bots as they were unable to solve or even complete the challenge. </p><p>Let’s look at another example. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5yiAMOgmFxLFSYV65oAxQO/d33d37af63e6871f98015e7650780799/9.png" />
          </figure><p><i>Example Token validation section </i></p><p>In this case, of the 11.13M tokens issued in the timeframe, 0.01% of them were invalid. This means that 0.01% of the traffic is considered to be non-legitimate visitors, despite the fact that they received the Turnstile tokens.  This is why it is crucial to always validate your tokens through the Siteverify API. What becomes more interesting is if the login credentials these suspicious visitors provided were correct credentials, which could indicate that this is a potential account takeover attack or the accounts in question have been compromised. If the login credentials were incorrect, but the attempts were in a burst, that could indicate credential stuffing attack. By correlating Turnstile analytics with your internal application data such as whether the login attempt had a correct or incorrect password, you can further identify the nature and behavior of the attacker and build out the defenses or mitigate accordingly. </p><p>This was an example showing how Turnstile can protect and provide insights on just your login page. Imagine how this could be expanded to other use cases such as your sign-up pages, submit form pages, contact pages, checkout pages, and more. </p>
    <div>
      <h3>Looking ahead</h3>
      <a href="#looking-ahead">
        
      </a>
    </div>
    <p>We are not planning on stopping here with Turnstile Analytics. Next on our roadmap is to expand Turnstile Analytics to give you more insights around client side and server side errors, so that you can further break down the traffic beyond just the challenge outcomes. We will also be incorporating <a href="https://developers.cloudflare.com/turnstile/concepts/ephemeral-id/"><u>Ephemeral IDs</u></a> into the analytics, so that you can filter by Ephemeral ID, see top Ephemeral IDs, and the frequency of their solve attempts. </p><p>We have many more exciting things in store for Turnstile for 2025! There is no prerequisite with Turnstile, and our free tier is unlimited in volume, so there is no barrier to <a href="https://developers.cloudflare.com/turnstile/get-started/"><u>get started today</u></a>. Let's help make the Internet a more secure, better place, together!</p> ]]></content:encoded>
            <category><![CDATA[Security Week]]></category>
            <category><![CDATA[Turnstile]]></category>
            <category><![CDATA[Analytics]]></category>
            <guid isPermaLink="false">6641QNULmSTnzPNTAnksUZ</guid>
            <dc:creator>Sally Lee</dc:creator>
            <dc:creator>Ana Foppa</dc:creator>
            <dc:creator>Aleksandar Pavlov Hrusanov</dc:creator>
            <dc:creator>Rupert Carr</dc:creator>
        </item>
        <item>
            <title><![CDATA[Introducing Ephemeral IDs: a new tool for fraud detection]]></title>
            <link>https://blog.cloudflare.com/turnstile-ephemeral-ids-for-fraud-detection/</link>
            <pubDate>Mon, 23 Sep 2024 13:00:00 GMT</pubDate>
            <description><![CDATA[ As the Internet evolves, Turnstile does too. Introducing Ephemeral IDs — a new dimension in detecting fraudulent activity, bot or human, that links behavior to a specific client instead of an IP address. This makes Turnstile better for everyone, everywhere. 
 ]]></description>
            <content:encoded><![CDATA[ <p>In the early days of the Internet, a single IP address was a reliable indicator of a single user. However, today’s Internet is more complex. Shared IP addresses are now common, with users connecting via mobile IP address pools, VPNs, or behind <a href="https://en.wikipedia.org/wiki/Carrier-grade_NAT"><u>CGNAT (Carrier Grade Network Address Translation)</u></a>. This makes relying on IP addresses alone a weak method to combat modern threats like automated attacks and fraudulent activity. Additionally, many Internet users have no option but to use an IP address which they don’t have sole control over, and as such, <a href="https://blog.cloudflare.com/consequences-of-ip-blocking/"><u>should not be penalized for that</u></a>.</p><p>At Cloudflare, we are solving this complexity with <a href="https://developers.cloudflare.com/turnstile/"><u>Turnstile</u></a>, our <a href="https://blog.cloudflare.com/turnstile-private-captcha-alternative/"><u>CAPTCHA alternative</u></a>. And now, we’re taking the next step in advancing security with Ephemeral IDs, a new feature that generates a unique short-lived ID, without relying on any network-level information.</p><p>When a website visitor interacts with Turnstile, we now calculate an Ephemeral ID that can link behavior to a specific client instead of an IP address. This means that even when attackers rotate through large pools of IP addresses, we can still identify and block malicious actions. For example, in attacks like <a href="https://www.cloudflare.com/learning/bots/what-is-credential-stuffing/"><u>credential stuffing</u></a> or account signups, where fraudsters attempt to disguise themselves using different IP addresses, Ephemeral IDs allow us to detect abuse patterns more accurately beyond just determining whether the visitor is a human or a bot. Multiple fraudulent actions from the same client are grouped together, improving our detection rate while reducing false positives.</p>
    <div>
      <h3>How Ephemeral IDs work</h3>
      <a href="#how-ephemeral-ids-work">
        
      </a>
    </div>
    <p>Turnstile detects bots by analyzing browser attributes and signals. Using these aggregated client-side signals, we generate a short-lived Ephemeral ID without setting any cookies or using similar client-side storage. These IDs are intentionally not 100% unique and have a brief lifespan, making them highly effective in identifying patterns of fraud and abuse, without compromising user privacy.</p><p>When the same visitor interacts with Turnstile widgets from different Cloudflare customers, they receive different Ephemeral IDs for each one. Additionally, because these IDs change frequently, they cannot be used to track a single visitor over multiple days.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2uGotegS95KA9Ea5qRsQgs/71f01ce9c9a8096e7c64cdfc470ddeb0/BLOG-2548_2.png" />
          </figure><p><sub><i>Blue: A single IP address | Green: A single Ephemeral ID</i></sub><sub>
</sub><sub><i>The bigger the node, the more frequently seen that ID or IP address was in our dataset.</i></sub></p><p>The graphic above illustrates the complex reality of the modern Internet, where the relationship between clients and IP addresses is far from a simple one-to-one mapping. While some straightforward mappings still exist, they are no longer the norm.</p><p>During a period where a site or service is under attack, we observe a “nest” of highly correlated Ephemeral IDs. In the example below, the correlation is based on both Ephemeral ID and IP address.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5Rk4QXW1nkrrIk46XgzXdA/52739f21e6a00643a511de77b47142f1/BLOG-2548_3.png" />
          </figure><p><sub><i>Nest in the center of the diagram visualizes thousands of IP addresses (blue) which are correlated by the commonly identified Ephemeral IDs (green). The bigger the node, the more frequently seen that ID or IP address was in our dataset.</i></sub></p><p>This is real-world data showing fraudulent activity on one of Cloudflare’s public-facing forms. Even with access to a broad range of IP addresses, attackers struggle to completely disguise their requests because Ephemeral IDs are generated based on patterns beyond IP addresses. This means that even if they rotate addresses, the underlying client characteristics are still detected, making it harder for them to evade our security measures. This makes it easier for us to group these requests and apply appropriate business logic, whether that means discarding the requests, requiring further validation, enforcing <a href="https://www.cloudflare.com/learning/access-management/what-is-multi-factor-authentication/"><u>multi-factor authentication (MFA)</u></a>, or other actions. </p><p>This new client identification technology seamlessly integrates into the broader advancements we’ve made to Turnstile over the past year. Whether you’re protecting <a href="https://developers.cloudflare.com/turnstile/tutorials/login-pages/"><u>login forms</u></a>, signup pages, or high value transactions, you’ll immediately benefit from this extra layer of abuse detection <b>without needing to change a single line of code</b>. We’ll take care of all the heavy lifting and analysis behind the scenes, and our system will continue to improve its accuracy and effectiveness over time.</p><p>What does this mean for you? Starting today, <a href="https://www.cloudflare.com/products/turnstile/"><u>Turnstile</u></a> will go beyond just identifying bots. <b>All</b> <b>websites protected by Turnstile will automatically benefit</b> from the integration of Ephemeral IDs into our detection logic. This means we can more effectively identify and penalize offending clients without impacting other users on the same network, or IP address, improving security and user experience for everyone.</p>
    <div>
      <h3>Ephemeral IDs in action</h3>
      <a href="#ephemeral-ids-in-action">
        
      </a>
    </div>
    <p>Everyone benefits from the addition of Ephemeral IDs to the Challenge Platform, but for those who want to use it beyond that, the Ephemeral ID is available through the Turnstile <a href="https://developers.cloudflare.com/turnstile/get-started/server-side-validation/"><u>siteverify</u></a> response. A practical use case for Ephemeral IDs is preventing fraudulent account signups. Imagine a bad actor, a real person using a real device, creating hundreds of fake accounts while rotating IP addresses to avoid detection. By ingesting Ephemeral IDs and logging them alongside your account creation logs, you can set up alerts based on account creation thresholds in real-time or retroactively investigate suspicious activity. Even though Ephemeral IDs are short-lived and may have changed by the time an investigation begins, they still provide valuable insights through aggregate analysis, and provide an extra dimension to identify fraud and abuse.</p><p>For our <b>Turnstile Enterprise </b>and<b> Bot Management Enterprise </b>customers, you now have the option to access Ephemeral IDs directly through the Turnstile siteverify response. Get in touch with your Account Executive to enable it on your account.</p><p>Below is an example of <a href="https://developers.cloudflare.com/turnstile/get-started/server-side-validation/"><u>siteverify</u></a> response for those who have enabled Ephemeral IDs.</p>
            <pre><code>curl 'https://challenges.cloudflare.com/turnstile/v0/siteverify' --data 'secret=verysecret&amp;response=&lt;RESPONSE&gt;'</code></pre>
            
            <pre><code>{
    "success": true,
    "error-codes": [],
    "challenge_ts": "2024-09-10T17:29:00.463Z",
    "hostname": "example.com",
    "metadata": {
        "ephemeral_id": "x:9f78e0ed210960d7693b167e"
    }
}
</code></pre>
            
    <div>
      <h2>What’s next for Turnstile?</h2>
      <a href="#whats-next-for-turnstile">
        
      </a>
    </div>
    <p>We launched Turnstile with a bold mission: to redefine CAPTCHAs with a frictionless, privacy-first solution that eliminates the annoyance of picking puzzles, selecting stoplights, and clicking crosswalks to prove our humanity. It’s incredible to think that Turnstile has been generally available for a whole year now! During this time, it has blocked over <b>one trillion bots</b>, and is actively protecting more than <b>350,000 domains</b> worldwide.</p><p>As we celebrate Turnstile’s second birthday, we’re proud of the progress we’ve made and thrilled to introduce our latest innovations. While Ephemeral IDs represent the newest evolution of Turnstile, they’re part of our ongoing commitment to continuous improvement. Over the past year, we’ve also introduced a <a href="https://blog.cloudflare.com/guide-to-cloudflare-pages-and-turnstile-plugin/"><u>Cloudflare Pages Plugin</u></a> and partnered with <a href="https://developers.cloudflare.com/turnstile/extensions/google-firebase/"><u>Google Firebase</u></a>, ensuring that developers have easy access to Turnstile.</p><p>Earlier this year, we also launched <a href="https://blog.cloudflare.com/integrating-turnstile-with-the-cloudflare-waf-to-challenge-fetch-requests/"><u>Pre-Clearance</u></a> for Turnstile, integrating it with Cloudflare WAF’s Challenge action, making it easier for customers to use Cloudflare’s Application Security products together. If you want to learn more about how to use Turnstile with Cloudflare’s Bot Management and WAF in more detail, check it out <a href="https://developers.cloudflare.com/turnstile/tutorials/integrating-turnstile-waf-and-bot-management"><u>here</u></a>!</p><p>We’re incredibly excited about what’s ahead. The introduction of Ephemeral IDs is just one of many innovations on the horizon. We’re committed to making the Internet a safer, more private place for everyone, eliminating the need for frustrating CAPTCHA puzzles while keeping security our top priority. And with our free tier remaining open and unlimited for all, there’s no barrier to getting started with Turnstile today.</p><p>Join us in revolutionizing online security –<b> </b><a href="https://developers.cloudflare.com/turnstile/get-started/"><b><u>get started with Turnstile</u></b></a><b> </b>now or dive straight into our<b> </b><a href="https://developers.cloudflare.com/turnstile/tutorials/"><b><u>how-to guides</u></b></a>. Let’s help make the Internet a better place, together!</p> ]]></content:encoded>
            <category><![CDATA[Birthday Week]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Turnstile]]></category>
            <category><![CDATA[CAPTCHA]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Bots]]></category>
            <category><![CDATA[Privacy]]></category>
            <category><![CDATA[Network Services]]></category>
            <guid isPermaLink="false">6V6W6JxQO7bnM0CbhuO1OA</guid>
            <dc:creator>Oliver Payne</dc:creator>
            <dc:creator>Sally Lee</dc:creator>
            <dc:creator>Benedikt Wolters</dc:creator>
        </item>
        <item>
            <title><![CDATA[Building secure websites: a guide to Cloudflare Pages and Turnstile Plugin]]></title>
            <link>https://blog.cloudflare.com/guide-to-cloudflare-pages-and-turnstile-plugin/</link>
            <pubDate>Thu, 07 Mar 2024 14:00:52 GMT</pubDate>
            <description><![CDATA[ Learn how to use Cloudflare Pages and Turnstile to deploy your website quickly and easily while protecting it from bots, without compromising user experience. Follow our tutorial here for a seamless integration ]]></description>
            <content:encoded><![CDATA[ 
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2K7WFOjmj3tTCZ2C90XOzp/1fd9487aaaf44a7b6f853f82f9e2be5f/image1-26.png" />
            
            </figure><p>Balancing developer velocity and security against bots is a constant challenge. Deploying your changes as quickly and easily as possible is essential to stay ahead of your (or your customers’) needs and wants. Ensuring your website is safe from malicious bots — without degrading user experience with alien hieroglyphics to decipher just to prove that you are a human — is no small feat. With <a href="https://pages.cloudflare.com/">Pages</a> and <a href="https://developers.cloudflare.com/turnstile/">Turnstile</a>, we'll walk you through just how easy it is to have the best of both worlds!</p><p><a href="https://pages.cloudflare.com/">Cloudflare Pages</a> offer a seamless platform for deploying and scaling your websites with ease. You can get started right away with configuring your websites with a quick integration using your git provider, and get set up with unlimited requests, bandwidth, collaborators, and projects.</p><p>Cloudflare Turnstile is Cloudflare’s <a href="https://www.cloudflare.com/products/turnstile/">CAPTCHA alternative solution</a> where your users don’t ever have to solve another puzzle to get to your website, no more stop lights and fire hydrants. You can protect your site without having to put your users through an annoying user experience. If you are already using another CAPTCHA service, we have made it easy for you to <a href="https://developers.cloudflare.com/turnstile/migration/">migrate over to Turnstile</a> with minimal effort needed. Check out the <a href="https://developers.cloudflare.com/turnstile/">Turnstile documentation</a> to get started.</p>
    <div>
      <h3>Alright, what are we building?</h3>
      <a href="#alright-what-are-we-building">
        
      </a>
    </div>
    <p>In this tutorial, we'll walk you through integrating Cloudflare Pages with Turnstile to secure your website against bots. You'll learn how to deploy Pages, embed the Turnstile widget, validate the token on the server side, and monitor Turnstile analytics. Let’s build upon <a href="https://developers.cloudflare.com/pages/tutorials/forms/">this tutorial</a> from Cloudflare’s developer docs, which outlines how to create an HTML form with Pages and Functions. We’ll also show you how to secure it by integrating with Turnstile, complete with client-side rendering and server-side validation, using the <a href="https://developers.cloudflare.com/pages/functions/plugins/turnstile/">Turnstile Pages Plugin</a>!</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4DaVCMwbVOKW17aOgthwZh/f756f3466f64bc4f889a5b9ea497b910/Screenshot-2024-03-07-at-11.52.43.png" />
            
            </figure>
    <div>
      <h3>Step 1: Deploy your Pages</h3>
      <a href="#step-1-deploy-your-pages">
        
      </a>
    </div>
    <p>On the Cloudflare Dashboard, select your account and go to Workers &amp; Pages to create a new Pages application with your git provider. Choose the repository where you cloned the tutorial project or any other repository that you want to use for this walkthrough.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5kZP90IyFiaZzl7fX608Dl/355af9d8c998c19e0c032df65d14c324/image2-23.png" />
            
            </figure><p>The Build settings for this project is simple:</p><ul><li><p><b>Framework preset</b>: None</p></li><li><p><b>Build command</b>: npm install @cloudflare/pages-plugin-turnstile</p></li><li><p><b>Build output directory</b>: public</p></li></ul><p>Once you select “Save and Deploy”, all the magic happens under the hood and voilà! The form is already deployed.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6I301dY7rRKreWxUwEuHs/7ea859c666d3c04b39c139c47d3b1c7f/image8-3.png" />
            
            </figure>
    <div>
      <h3>Step 2: Embed Turnstile widget</h3>
      <a href="#step-2-embed-turnstile-widget">
        
      </a>
    </div>
    <p>Now, let’s navigate to Turnstile and add the newly created Pages site.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5BadX97G4W7s5FUuMx82MV/891f196d7f6840d7773684c13d9173ab/image5-14.png" />
            
            </figure><p>Here are the widget configuration options:</p><ul><li><p><b>Domain</b>: All you need to do is add the domain for the Pages application. In this example, it’s “pages-turnstile-demo.pages.dev”. For each deployment, Pages generates a <a href="https://developers.cloudflare.com/pages/configuration/preview-deployments/">deployment specific preview</a> subdomain. Turnstile covers all subdomains automatically, so your Turnstile widget will work as expected even in your previews. This is covered more extensively in our <a href="https://developers.cloudflare.com/turnstile/reference/domain-management/">Turnstile domain management documentation</a>.</p></li><li><p><b>Widget Mode</b>: There are three types of <a href="https://developers.cloudflare.com/turnstile/reference/widget-types/">widget modes</a> you can choose from.</p></li><li><p><b>Managed</b>: This is the recommended option where Cloudflare will decide when further validation through the checkbox interaction is required to confirm whether the user is a human or a bot. This is the mode we will be using in this tutorial.</p></li></ul>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/78AnsttFltsSDTWMXxFjnH/d1ee443938d095a4d44874607c046760/Screenshot-2024-03-07-at-11.54.30.png" />
            
            </figure><ul><li><p><b>Non-interactive</b>: This mode does not require the user to interact and check the box of the widget. It is a non-intrusive mode where the widget is still visible to users but requires no added step in the user experience.</p></li></ul>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2EAIzU3P7JhQKFteYXb4Hq/1b39212a5393124a081bef94c7d9a07d/Screenshot-2024-03-07-at-11.55.00.png" />
            
            </figure><ul><li><p><b>Invisible</b>: Invisible mode is where the widget is not visible at all to users and runs in the background of your website.</p></li><li><p><b>Pre-Clearance setting</b>: With a clearance cookie issued by the Turnstile widget, you can configure your website to verify every single request or once within a session. To learn more about <a href="/integrating-turnstile-with-the-cloudflare-waf-to-challenge-fetch-requests">implementing pre-clearance with Turnstile</a>, check out this blog post.</p></li></ul><p>Once you create your widget, you will be given a sitekey and a secret key. The sitekey is public and used to invoke the Turnstile widget on your site. The secret key should be stored safely for security purposes.</p><p>Let’s embed the widget above the Submit button. Your index.html should look like this:</p>
            <pre><code>&lt;!doctype html&gt;
&lt;html lang="en"&gt;
	&lt;head&gt;
		&lt;meta charset="utf8"&gt;
		&lt;title&gt;Cloudflare Pages | Form Demo&lt;/title&gt;
		&lt;meta name="theme-color" content="#d86300"&gt;
		&lt;meta name="mobile-web-app-capable" content="yes"&gt;
		&lt;meta name="apple-mobile-web-app-capable" content="yes"&gt;
		&lt;meta name="viewport" content="width=device-width,initial-scale=1"&gt;
		&lt;link rel="icon" type="image/png" href="https://www.cloudflare.com/favicon-128.png"&gt;
		&lt;link rel="stylesheet" href="/index.css"&gt;
		&lt;script src="https://challenges.cloudflare.com/turnstile/v0/api.js?onload=_turnstileCb" defer&gt;&lt;/script&gt;
	&lt;/head&gt;
	&lt;body&gt;

		&lt;main&gt;
			&lt;h1&gt;Demo: Form Submission&lt;/h1&gt;

			&lt;blockquote&gt;
				&lt;p&gt;This is a demonstration of Cloudflare Pages with Turnstile.&lt;/p&gt;
				&lt;p&gt;Pages deployed a &lt;code&gt;/public&lt;/code&gt; directory, containing a HTML document (this webpage) and a &lt;code&gt;/functions&lt;/code&gt; directory, which contains the Cloudflare Workers code for the API endpoint this &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; references.&lt;/p&gt;
				&lt;p&gt;&lt;b&gt;NOTE:&lt;/b&gt; On form submission, the API endpoint responds with a JSON representation of the data. There is no JavaScript running in this example.&lt;/p&gt;
			&lt;/blockquote&gt;

			&lt;form method="POST" action="/api/submit"&gt;
				&lt;div class="input"&gt;
					&lt;label for="name"&gt;Full Name&lt;/label&gt;
					&lt;input id="name" name="name" type="text" /&gt;
				&lt;/div&gt;

				&lt;div class="input"&gt;
					&lt;label for="email"&gt;Email Address&lt;/label&gt;
					&lt;input id="email" name="email" type="email" /&gt;
				&lt;/div&gt;

				&lt;div class="input"&gt;
					&lt;label for="referers"&gt;How did you hear about us?&lt;/label&gt;
					&lt;select id="referers" name="referers"&gt;
						&lt;option hidden disabled selected value&gt;&lt;/option&gt;
						&lt;option value="Facebook"&gt;Facebook&lt;/option&gt;
						&lt;option value="Twitter"&gt;Twitter&lt;/option&gt;
						&lt;option value="Google"&gt;Google&lt;/option&gt;
						&lt;option value="Bing"&gt;Bing&lt;/option&gt;
						&lt;option value="Friends"&gt;Friends&lt;/option&gt;
					&lt;/select&gt;
				&lt;/div&gt;

				&lt;div class="checklist"&gt;
					&lt;label&gt;What are your favorite movies?&lt;/label&gt;
					&lt;ul&gt;
						&lt;li&gt;
							&lt;input id="m1" type="checkbox" name="movies" value="Space Jam" /&gt;
							&lt;label for="m1"&gt;Space Jam&lt;/label&gt;
						&lt;/li&gt;
						&lt;li&gt;
							&lt;input id="m2" type="checkbox" name="movies" value="Little Rascals" /&gt;
							&lt;label for="m2"&gt;Little Rascals&lt;/label&gt;
						&lt;/li&gt;
						&lt;li&gt;
							&lt;input id="m3" type="checkbox" name="movies" value="Frozen" /&gt;
							&lt;label for="m3"&gt;Frozen&lt;/label&gt;
						&lt;/li&gt;
						&lt;li&gt;
							&lt;input id="m4" type="checkbox" name="movies" value="Home Alone" /&gt;
							&lt;label for="m4"&gt;Home Alone&lt;/label&gt;
						&lt;/li&gt;
					&lt;/ul&gt;
				&lt;/div&gt;
				&lt;div id="turnstile-widget" style="padding-top: 20px;"&gt;&lt;/div&gt;
				&lt;button type="submit"&gt;Submit&lt;/button&gt;
			&lt;/form&gt;
		&lt;/main&gt;
	&lt;script&gt;
	// This function is called when the Turnstile script is loaded and ready to be used.
	// The function name matches the "onload=..." parameter.
	function _turnstileCb() {
	    console.debug('_turnstileCb called');

	    turnstile.render('#turnstile-widget', {
	      sitekey: '0xAAAAAAAAAXAAAAAAAAAAAA',
	      theme: 'light',
	    });
	}
	&lt;/script&gt;
	&lt;/body&gt;
&lt;/html&gt;</code></pre>
            <p>You can embed the Turnstile widget implicitly or explicitly. In this tutorial, we will explicitly embed the widget by injecting the JavaScript tag and related code, then specifying the placement of the widget.</p>
            <pre><code>&lt;script src="https://challenges.cloudflare.com/turnstile/v0/api.js?onload=_turnstileCb" defer&gt;&lt;/script&gt;</code></pre>
            
            <pre><code>&lt;script&gt;
	function _turnstileCb() {
	    console.debug('_turnstileCb called');

	    turnstile.render('#turnstile-widget', {
	      sitekey: '0xAAAAAAAAAXAAAAAAAAAAAA',
	      theme: 'light',
	    });
	}
&lt;/script&gt;</code></pre>
            <p>Make sure that the <code>div id</code> you assign is the same as the <code>id</code> you specify in <code>turnstile.render</code> call. In this case, let’s use <code>“turnstile-widget”</code>. Once that’s done, you should see the widget show up on your site!</p>
            <pre><code>&lt;div id="turnstile-widget" style="padding-top: 20px;"&gt;&lt;/div&gt;</code></pre>
            
    <div>
      <h3>Step 3: Validate the token</h3>
      <a href="#step-3-validate-the-token">
        
      </a>
    </div>
    <p>Now that the Turnstile widget is rendered on the front end, let’s validate it on the server side and check out the Turnstile outcome. We need to make a call to the <code>/siteverify</code> API with the token in the submit function under <code>./functions/api/submit.js</code>.</p><p>First, grab the token issued from Turnstile under cf-turnstile-response. Then, call the <code>/siteverify</code> API to ensure that the token is valid. In this tutorial, we’ll attach the Turnstile outcome to the response to verify everything is working well. You can decide on the expected behavior and where to direct the user based on the <code>/siteverify</code> response.</p>
            <pre><code>/**
 * POST /api/submit
 */

import turnstilePlugin from "@cloudflare/pages-plugin-turnstile";

// This is a demo secret key. In prod, we recommend you store
// your secret key(s) safely. 
const SECRET_KEY = '0x4AAAAAAASh4E5cwHGsTTePnwcPbnFru6Y';

export const onRequestPost = [
    turnstilePlugin({
    	secret: SECRET_KEY,
    }),
    (async (context) =&gt; {
    	// Request has been validated as coming from a human
    	const formData = await context.request.formData()

    	var tmp, outcome = {};
	for (let [key, value] of formData) {
		tmp = outcome[key];
		if (tmp === undefined) {
			outcome[key] = value;
		} else {
			outcome[key] = [].concat(tmp, value);
		}
	}

	// Attach Turnstile outcome to the response
	outcome["turnstile_outcome"] = context.data.turnstile;

	let pretty = JSON.stringify(outcome, null, 2);

      	return new Response(pretty, {
      		headers: {
      			'Content-Type': 'application/json;charset=utf-8'
      		}
      	});
    })
];</code></pre>
            <p>Since Turnstile accurately decided that the visitor was not a bot, the response for “success” is “true” and “interactive” is “false”. The “interactive” being “false” means that the checkbox was automatically checked by Cloudflare as the visitor was determined to be human. The user was seamlessly allowed access to the website without having to perform any additional actions. If the visitor looks suspicious, Turnstile will become interactive, requiring the visitor to actually click the checkbox to verify that they are not a bot. We used the managed mode in this tutorial but depending on your application logic, you can choose the widget mode that works best for you.</p>
            <pre><code>{
  "name": "Sally Lee",
  "email": "sallylee@cloudflare.com",
  "referers": "Facebook",
  "movies": "Space Jam",
  "cf-turnstile-response": "0._OHpi7JVN7Xz4abJHo9xnK9JNlxKljOp51vKTjoOi6NR4ru_4MLWgmxt1rf75VxRO4_aesvBvYj8bgGxPyEttR1K2qbUdOiONJUd5HzgYEaD_x8fPYVU6uZPUCdWpM4FTFcxPAnqhTGBVdYshMEycXCVBqqLVdwSvY7Me-VJoge7QOStLOtGgQ9FaY4NVQK782mpPfgVujriDAEl4s5HSuVXmoladQlhQEK21KkWtA1B6603wQjlLkog9WqQc0_3QMiBZzZVnFsvh_NLDtOXykOFK2cba1mLLcADIZyhAho0mtmVD6YJFPd-q9iQFRCMmT2Sz00IToXz8cXBGYluKtxjJrq7uXsRrI5pUUThKgGKoHCGTd_ufuLDjDCUE367h5DhJkeMD9UsvQgr1MhH3TPUKP9coLVQxFY89X9t8RAhnzCLNeCRvj2g-GNVs4-MUYPomd9NOcEmSpklYwCgLQ.jyBeKkV_MS2YkK0ZRjUkMg.6845886eb30b58f15de056eeca6afab8110e3123aeb1c0d1abef21c4dd4a54a1",
  "turnstile_outcome": {
    "success": true,
    "error-codes": [],
    "challenge_ts": "2024-02-28T22:52:30.009Z",
    "hostname": "pages-turnstile-demo.pages.dev",
    "action": "",
    "cdata": "",
    "metadata": {
      "interactive": false
    }
  }
}</code></pre>
            
    <div>
      <h3>Wrapping up</h3>
      <a href="#wrapping-up">
        
      </a>
    </div>
    <p>Now that we've set up Turnstile, we can head to Turnstile analytics in the <a href="https://dash.cloudflare.com/?to=/:account/turnstile">Cloudflare Dashboard</a> to monitor the <a href="https://developers.cloudflare.com/turnstile/reference/tooltips/">solve rate</a> and widget traffic. Visitor Solve Rate indicates the percentage of visitors who successfully completed the Turnstile widget. A sudden drop in the Visitor Solve Rate could indicate an increase in bot traffic, as bots may fail to complete the challenge presented by the widget. API Solve Rate measures the percentage of visitors who successfully validated their token against the <code>/siteverify</code> API. Similar to the Visitor Solve Rate, a significant drop in the API Solve Rate may indicate an increase in bot activity, as bots may fail to validate their tokens. Widget Traffic provides insights into the nature of the traffic hitting your website. A high number of challenges requiring interaction may suggest that bots are attempting to access your site, while a high number of unsolved challenges could indicate that the Turnstile widget is effectively blocking suspicious traffic.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6LS7efg5RG5VVEE9VVh41n/0c4f7feaeb2c693ea47df2229efa2091/image6-4.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4rZfKrfY91tTRuCvJgFFHU/3a689f0b7a066d2d85fb09725859bd20/image9-1.png" />
            
            </figure><p>And that’s it! We’ve walked you through how to easily secure your Pages with Turnstile. Pages and Turnstile are currently available for free for every Cloudflare user to get started right away. If you are looking for a seamless and speedy developer experience to get a secure website up and running, protected by Turnstile, head over to the <a href="https://dash.cloudflare.com/?to=/:account/turnstile">Cloudflare Dashboard</a> today!</p> ]]></content:encoded>
            <category><![CDATA[Security Week]]></category>
            <category><![CDATA[Turnstile]]></category>
            <category><![CDATA[CAPTCHA]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Cloudflare Pages]]></category>
            <category><![CDATA[Bots]]></category>
            <category><![CDATA[Speed & Reliability]]></category>
            <guid isPermaLink="false">1XOUeKfqYNFTbbeERuAxAg</guid>
            <dc:creator>Sally Lee</dc:creator>
        </item>
    </channel>
</rss>