Create a paywall and subscription SEO: structured data, meter rules, and crawler…
- User
Create a paywall and subscription SEO: structured data, meter rules, and crawler allowances.
Assistant
Create a paywall and subscription SEO: structured data, meter rules, and crawler allowances.
The user wants advice and implementation details for a "paywall and subscription SEO" strategy. This involves three specific areas:
isAccessibleForFree and hasPart.robots.txt and specific directives for Googlebot and other search engine crawlers.Step 1: Structured Data (Schema Markup)
NewsArticle or Article schema.isAccessibleForFree: Set to false for the paywalled section.hasPart: Defines the paywalled section.hasPart:
@type: WebPageElement.isAccessibleForFree: false.hasOccupancy: (Optional, but isAccessibleForFree is the critical one).<head> or <body> of the HTML.Step 2: Meter Rules (Content Sampling)
User-Agent contains "Googlebot", serve full content.Step 3: Crawler Allowances (Robots.txt & Server Config)
/account, /settings), but allow the articles themselves.Step 4: Structuring the Response I should organize this logically for a developer or SEO manager.
Refining the Content:
Self-Correction/Review during drafting:
isAccessibleForFree property is used both at the top level (if the whole page is free) or inside hasPart (if part is paywalled). The specific requirement for paywalled content is hasPart with isAccessibleForFree: False.Final Polish: Format code blocks clearly. Use bolding for emphasis. Create a "Why this matters" section for context.
Let's build the response based on this structure.
(Drafting the JSON-LD example mentally...)
{
"@context": "https://schema.org",
"@type": "NewsArticle",
"headline": "...',
"isAccessibleForFree": "False",
"hasPart": {
"@type": "WebPageElement",
"isAccessibleForFree": "False"
}
}
Wait, usually the headline and image are free. The body is paywalled. The hasPart identifies the paywalled section. Actually, Google's documentation says to mark the entire article as isAccessibleForFree: False if it requires a subscription, and use hasPart to define the class of the paywalled content. Let's stick to the official Google documentation example structure.
(Drafting Robots.txt)
User-agent: *
Allow: /
Disallow: /login
Disallow: /subscribe/step-2 (Keep funnel pages relevant though).
Also, mention User-agent: Googlebot specifically to ensure no accidental blocks.
(Drafting Server Logic) If IP == Google && DNS verified -> Serve Full Content. Else If User Logged In -> Serve Full Content. Else -> Serve Teaser + Paywall.
Looks solid. I will generate the response now. To implement a paywall that is SEO-friendly, you must adhere to Google’s "Flexible Sampling" model. This allows you to monetize content without suffering from "Cloaking" penalties (showing different content to Google than to users).
Here is the technical implementation guide for Structured Data, Meter Rules, and Crawler Allowances.
You must explicitly tell search engines that the content is behind a paywall. This prevents Google from treating the hidden content as "Cloaking."
The Logic: Use isAccessibleForFree set to False and define the hasPart property for the paywalled section.
Implementation: Place this script in the <head> or <body> of your article page.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "NewsArticle",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://example.com/premium-article-url"
},
"headline": "Exclusive Analysis: The Future of AI",
"image": "https://example.com/image.jpg",
"datePublished": "2023-10-25T08:00:00+08:00",
"dateModified": "2023-10-25T09:20:00+08:00",
"author": {
"@type": "Person",
"name": "Jane Doe"
},
"publisher": {
"@type": "Organization",
"name": "Example News",
"logo": {
"@type": "ImageObject",
"url": "https://example.com/logo.jpg"
}
},
"description": "A deep dive into emerging AI trends...",
"isAccessibleForFree": "False",
"hasPart": [
{
"@type": "WebPageElement",
"isAccessibleForFree": "False",
"cssSelector": ".paywall-content"
}
]
}
</script>
isAccessibleForFree: Set to False for the whole page if the majority is paywalled.cssSelector: This must match the CSS class of the div containing your paywalled text.You must allow crawlers (Googlebot, Bingbot) to access your CSS, JavaScript, and Image files so they can render the page and see the paywall structure.
The Logic: Do not block access to the article URL itself. If you block the URL in robots.txt, Google cannot see the structured data or the snippet, and the page will not rank.
Implementation (robots.txt):
# Allow all bots to access the site
User-agent: *
Allow: /
# Specifically ensure CSS and JS are not blocked
Allow: /*.css$
Allow: /*.js$
# Do not block specific article URLs
# BAD: Disallow: /premium/ <-- Do not do this.
Subscriptions Feed (Google Specific): For Google News/Subscribe, you should also implement a "Subscription Feed" via the Google Publisher Center, but the on-page Structured Data above is the primary technical requirement for Search.
This is the most critical technical aspect. To avoid penalties, Googlebot must see the same content as an anonymous user, but you must handle the meter logic carefully.
Google recommends allowing a certain amount of access (e.g., 1 to 10 articles free per day) or a sampling method.
Server-Side Pseudo-Code Logic:
function handleRequest(request, response) {
const userAgent = request.headers['user-agent'];
const ip = request.connection.remoteAddress;
const isGooglebot = verifyGoogleBot(userAgent, ip); // Function to verify via DNS
// 1. Check for Crawler
if (isGooglebot) {
// CRITICAL: Serve the FULL HTML content (rendered server-side)
// Do NOT redirect to a login page.
// This allows Google to index the text behind the paywall.
return response.send(fullArticleHTML);
}
// 2. Check User Meter (Standard User)
const userMeter = getMeter(request.cookies);
if (userMeter.count < userMeter.limit) {
// User is under the free limit: Show article, increment meter
incrementMeter(request.cookies);
return response.send(fullArticleHTML);
} else {
// User is over limit: Show Paywall
// You still serve the <head>, schema, and the first paragraph,
// but truncate the body content.
return response.send(paywallHTML);
}
}
Important Security Note (Verification):
You must verify the IP address via Reverse DNS lookup. Malicious scrapers often fake the User-Agent string to look like "Googlebot" to bypass your paywall.
Python example for verification:
import socket
def is_valid_google_bot(ip):
try:
# Reverse DNS lookup
hostname = socket.gethostbyaddr(ip)[0]
if hostname.endswith('.googlebot.com') or hostname.endswith('.google.com'):
# Forward DNS lookup to verify the hostname matches the IP
canonical_name = socket.gethostbyname_ex(hostname)[0]
if canonical_name == hostname:
return True
except:
pass
return False
How you hide the content physically in the browser matters for user experience, though Google relies on Structured Data for indexing.
Option A: Server-Side Truncation (Best for SEO) If the user is over the limit, the server simply stops sending HTML text for the body content after the 3rd paragraph.
Option B: CSS/JS Overlay (Easier Implementation)
The server sends the full text, but places it in a div with display: none or blurs it, using a script to reveal it only for subscribers.
The "Truncation" Snippet (HTML/CSS):
<article>
<h1>Article Title</h1>
<div class="intro-text">
<p>This is the free preview text that everyone can read...</p>
</div>
<!-- The class "paywall-content" links to the Structured Data selector -->
<div id="paywall-gate" class="paywall-content" style="display:none;">
<p>This is the premium content that requires a subscription...</p>
</div>
<script>
// If user is logged in, display the block
if(userIsLoggedIn) {
document.getElementById('paywall-gate').style.display = 'block';
}
</script>
</article>
robots.txt.NewsArticle schema with isAccessibleForFree: False and hasPart pointing to the content CSS selector.