Skip to content
Notifications
Clear all

Guide: How to set up rank tracking for a site with subdomains and subdirectories.

3 Posts
3 Users
0 Reactions
0 Views
(@cloud_ops_learner_2)
Reputable Member
Joined: 2 months ago
Posts: 234
Topic starter   [#23227]

Hey folks! 👋 I've been knee-deep in automating our cloud infrastructure, but recently had to set up proper rank tracking for a multi-tenant SaaS platform. Our setup uses subdomains for clients (`client1.ourplatform.com`) and subdirectories for specific regions (`client1.ourplatform.com/uk/blog`). I found most guides oversimplify this, and the tools themselves have some gotchas when your site structure isn't flat.

Here's a quick rundown of the approach I landed on, mixing some automation principles with the realities of SEO data:

**Key Considerations:**
* **Tracking Scope:** You need to decide if you're tracking the root domain, each subdomain independently, *and* key subdirectories. Tools often default to one profile for everything, which can muddy the data.
* **Keyword Mapping:** A keyword might rank for the root domain, a subdomain, *and* a subdirectory. You need to attribute it correctly to understand what's actually driving traffic.
* **Automation Potential:** Manually setting up dozens of profiles is a pain. Most rank trackers have APIs we can leverage.

Here's a basic Python snippet I used with the Ahrefs API (concept similar for SEMrush, Moz) to automate profile creation. This is after you've defined your site structure in a config file.

```python
import requests

# Define your base structure
sites_to_track = [
'ourplatform.com',
'client1.ourplatform.com',
'client2.ourplatform.com',
'ourplatform.com/us',
'ourplatform.com/uk/blog'
]

API_KEY = 'your_api_key_here'
API_URL = 'https://api.ahrefs.com/v3'

for target in sites_to_track:
payload = {
'target': target,
'mode': 'subdomain', # Use 'exact' for precise subdirectory, 'domain' for root+subdomains
'name': f'Track Profile: {target}'
}
headers = {'Authorization': f'Bearer {API_KEY}'}
# This is a simplified example - check the actual API endpoint & params
response = requests.post(f'{API_URL}/site-explorer/projects', headers=headers, data=payload)
print(f"Created profile for {target}: {response.status_code}")
```

**Gotchas I Encountered:**
* **Data Staleness:** Subdirectory data in some tools is updated less frequently than root domain data.
* **Crawl Limits:** When you create many profiles, you might hit hidden crawl limits. For a large site, data for deeper subdirectories can be incomplete or delayed.
* **Volume Inflation:** Some tools show "rankings" for pages that are actually canonicalized or redirecting, inflating your perceived visibility. Always cross-reference with Google Search Console data for key pages.

The main takeaway? Don't let the tool auto-configure your setup. Map your site architecture first, then explicitly create tracking profiles for each logical segment. It's more upfront work, but your data will be actionable.

Has anyone else automated this process with Terraform or Ansible for their infra? I'm curious if there's a way to integrate site structure definitions directly from our config management.

~CloudOps


Infrastructure as code is the only way


   
Quote
(@harperk)
Reputable Member
Joined: 3 weeks ago
Posts: 222
 

The API automation is the only sane path here, otherwise you're building a second full-time job. But you're dead on about attribution being the real snag.

That keyword mapping problem gets weird fast. We saw a case where the root domain ranked for a generic term, a subdomain ranked for a branded version, and a /us/ subdirectory scooped up the local intent queries. Most tools just shove it all into the 'top ranking URL' bucket for the primary profile, which is borderline useless for figuring out what to actually optimize.

The other gotcha is when the tracker's default location settings differ from your subdirectory targeting. A profile for /uk/blog pulling data from a US search engine dataset gives you a beautifully precise ranking number that's completely wrong.


Data over dogma.


   
ReplyQuote
(@bench_beast)
Honorable Member
Joined: 2 months ago
Posts: 320
 

Agreed on the automation. The API call speed is usually fine, but batch processing for keyword updates across many subdomains is where you hit rate limits. Most providers throttle hard after 500 profiles.

You also need to validate the location targeting per profile after creation. The Ahrefs API defaults to the account's main location, not the target country of the subdirectory. If you script the profile creation, hardcode the `location` parameter.

```python
# Example for a UK-targeted blog subdirectory
params = {
'target': 'client1.ourplatform.com/uk/blog',
'location': 'gb' # This is the gotcha
}
```


Benchmarks don't lie.


   
ReplyQuote