refback
This article is a stub. You can help the IndieWeb wiki by expanding it.
Refback is a linkback method that works using the standard HTTP Referer header.
Software Support
Refback has the benefit of not needing any support from the linking website. That means any website (ranging from dynamic WordPress blogs to html files written in Vim) has inherent support for it. You will need to implement support for it on your side, but this is usually simple to do.
Browser Support
Both Firefox and Chrome send referrer headers by default, but only include the origin - stripping everything apart from the domain name. This is controlled by the referrer policy
Implementation Details
Refback is dead simple to implement. There are no specs that you need to read through. You can make your implementation as simple or as complicated as you like. Refback basically gives you a single piece of data, the URL that your visitor came from. There are numerous things you can do with this URL.
- Save it in a database or log file
- This allows you to manually inspect and discover places that are sharing your website/sending you visitors.
- To make the huge amount of data easier to manually inspect, consider showing only unique referrers. If you are working with plaintext log files, you can use tools like
cut
andsort
.
- Show it on your website
- If you want to pay back the courtesy and link back to people, you can put the linkbacks under your article in a Mentions section.
- As with any user submissons, you should filter this for spam. Consider manually inspecting them after spam filters and modifications. Methods of linkback verification will be explained later.
- Analyze the data to improve your website
- You can analyze your Referrer data in order to determine the most important sources of your traffic. This will give you a good idea of which platforms you need to focus on.
- You can use proprietary tools like Google Analytics. It will provide valuable metrics about your visitors as well as a graph of your referrers (social networks and regular websites).
- If you want to keep the data to yourself (which is a good idea), you can use open-source tools like AWStats and GoAccess.
Linkback Verification
Even though you don't have to do it, you may find it useful to filter your Refbacks to cut down the false positives. One easy was of doing this is downloading the referring page and checking its HTML to see if it links to you. Doing this will cut down on both false positives and spam. Doing these checks asynchronously in the background is important to keep your pages from blocking.
Here's an example code in Python that naively verifies linkbacks.
import requests from bs4 import BeautifulSoup def verify_linkback(source, target): html = requests.get(source).text soup = BeautifulSoup(html) return len(soup.find_all("a", href=target)) > 0
IndieWeb Examples
Refback for WordPress plugin
David Shanske developed and maintains the Refback for WordPress plugin and selfdogfoods it on his primary website
Chris Aldrich uses this plugin on boffosocko.com
rubenwardy.com
rubenwardy has a script that tails his nginx logs looking for referrers to his blog pages. This currently just logs the URLs and referrers for manual investigation.
He found that most browsers strip all but the domain name, which makes this less useful for a webmentions-like feature. One option would be to crawl the source site looking for pages with such a link, but he hasn't implemented that yet.
See Also
- pingback
- trackback
- webmention
- Refback for WordPress, a plugin for implementing refbacks on WordPress
- Why Refback Still Matters?