🎬 Track website traffic & backlinks with Ahref API and Google Sheets

⚑ 481 views · 🎬 Content Creation & Video

Description

πŸ“Š Automated Website Traffic Tracker with Google Sheets Logging

Track website traffic and backlinks effortlessly using the Website Traffic Checker - Ahref API. This n8n workflow automates data retrieval and logging into Google Sheets, making it perfect for SEO professionals and digital marketers.


🧩 What This Workflow Does (Summary)

  1. Accepts a domain via a simple web form.

  2. Sends the domain to Website Traffic Checker - Ahref API.

  3. If successful:

    • Extracts backlink and traffic data.
    • Appends the results to two separate Google Sheets.
  4. If failed:

    • Sends an email alert with domain and status code.

πŸ”§ Node-by-Node Explanation

NodePurpose
🟒 Form TriggerStarts the workflow when a domain is submitted via form.
🟩 Set Domain ValueStores the submitted domain into a variable.
🌐 HTTP RequestCalls Website Traffic Checker - Ahref API.
βœ… IF NodeChecks if the API responded with statusCode = 200.
❌ Email Node (Fail)Sends an alert email if API fails.
πŸ“¦ Code (Backlink Info)Extracts backlink data from API response.
πŸ“„ Google Sheet: Backlink InfoAppends backlink data to a sheet.
πŸ“¦ Code (Traffic Info)Extracts traffic data from API response.
πŸ“„ Google Sheet: Traffic DataAppends traffic metrics to another sheet.

πŸ“ Google Sheet Columns

ColumnDescription
websiteDomain submitted
ascoreAuthority score
referring domainNumber of referring domains
total backlinksTotal backlinks

Traffic Data Sheet

ColumnDescription
accuracyAccuracy level of the traffic data
bounce_rateBounce rate percentage
desktop_sharePercentage of traffic from desktop devices
directDirect traffic sources
display_adDisplay ad traffic sources
display_dateDate when traffic data was captured
mailTraffic from email campaigns
mobile_sharePercentage of traffic from mobile devices
pages_per_visitAverage number of pages per visit
paidPaid traffic sources
prev_bounce_rateBounce rate in the previous period
prev_directPrevious period’s direct traffic
prev_display_adPrevious period’s display ad traffic
prev_mailPrevious period’s email traffic
prev_pages_per_visitPrevious period’s pages per visit
prev_referralPrevious period’s referral traffic
prev_search_organicPrevious organic search traffic
prev_search_paidPrevious paid search traffic
prev_social_organicPrevious organic social traffic
prev_social_paidPrevious paid social traffic
prev_time_on_sitePrevious time spent on site
prev_usersNumber of users in the previous period
prev_visitsVisits in the previous period
rankGlobal rank of the website
referralReferral traffic
searchTotal search traffic
search_organicOrganic search traffic
search_paidPaid search traffic
socialTotal social traffic
social_organicOrganic social traffic
social_paidPaid social traffic
targetTargeted country or demographic
time_on_siteAverage time spent on site
unknown_channelTraffic from unknown sources
usersNumber of unique users
visitsTotal number of visits

πŸ” How to Configure

πŸ”‘ Get API Key

  1. Go to Website Traffic Checker - Ahref API on RapidAPI.
  2. Sign in or create a free RapidAPI account.
  3. Subscribe to the API plan.
  4. Copy your x-rapidapi-key from the Endpoints tab.

πŸ“ Add Key in n8n

  1. Go to your HTTP Request node.

  2. Under Headers, set:

    • x-rapidapi-host = website-traffic-checker-ahref.p.rapidapi.com
    • x-rapidapi-key = your API key

πŸ“„ How to Setup Google Sheets in n8n

  1. Connect a Google account via Google Sheets credentials in n8n.
  2. Use the full Google Sheet URL in the documentId field.
  3. Set correct Sheet name or GID (e.g., β€œTraffic Data”).
  4. Use Auto Map or Custom Map to define columns.

> Make sure your Google Sheet has edit access and headers already created.


🧠 Use Case & Benefits

πŸ‘€ Ideal For:

βœ… Benefits:

πŸ”— Nodes Used

Send Email, Google Sheets, HTTP Request, n8n Form Trigger

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup