You work hard to get your content shared and you deserve to be able to display your social proof appropriately. But what if you end up changing your permalink structure? Or what if you decide to make your site more secure by adding SSL (https)?
Well, in most cases, all your social share counts will disappear.
Since social networks are only tracking counts against a specific URL, if that permalink structure changes it’s effectively a “new” URL. This happens even if you’ve done a great job at creating proper 301 redirects.
So our team wanted to build a tool right into our social sharing plugin that would solve this problem and allow you to recover all your precious share counts and social proof.
Background Information: How it Works
In order to recover your social share counts, Social Warfare will make 2 requests to the various social networks. One request will use your current URL permalink structure, the other will use your previous URL permalink structure. Once the numbers have been fetched, if they are not an exact match, we will add the numbers together before displaying them on the buttons.
If the numbers are an exact match, the plugin assumes that that network is tracking the change and has already compensated accordingly. However, this only usually applies to HTTP to HTTPS or WWW to non-WWW (or vica versa). However, if a proper system of 301 redirects are in place, some networks can detect other changes as well.
Note: Our plugin will only fetch share counts for 2 patterns, the current structure and one previous structure. If you’ve changed more than once then you’ll need to pick the previous structure that you believe has the most shares.
In order to come up with that secondary, previous URL permalink structure, you’ll need to tell our plugin what that structure used to look like. You can follow the steps below to accomplish that.
Step 1: Navigate to the Share Recovery Settings
Within your site’s dashboard, click on the Social Warfare menu item, then click on the Advanced tab at the top of the screen. Scroll down to Share Recovery and change the toggle to the ON position.
Share recovery enables you to bring back old shares from Pinterest and Facebook (in most cases) after changing your permalink structure or domain.
Facebook recovery is currently only possible under certain conditions on certain sites – unfortunately we can’t guarantee those shares can be recovered. Google Plus, LinkedIn, and Twitter shares cannot be recovered.
Step 2: Configure Share Recovery
Previous URL Format
If you’ve changed your permalink structure, use the dropdown to select the previous structure. If this hasn’t changed, leave it as “Unchanged.”
Custom Permalink Format
If you used a custom permalink structure previously that isn’t offered in the dropdown, choose “custom” from the dropdown and enter it here in this type of format:
/%category%/%postname%/
For a list of the acceptable parameters, please see the WordPress Codex.
Previous Connection Protocol
If you changed from http to https (or vice versa), use this dropdown to choose the old/former connection protocol. If this hasn’t changed, leave it set to “Unchanged.”
Previous Domain Prefix
If you’ve switched to or from using www, use this dropdown. If not, leave it set to “Unchanged.”
Subdomain
If you previously used a subdomain (such as blog.domain.com), enter the subdomain here without http or https. If not, leave it blank.
Former Domain and Current Domain
If you’ve changed your domain entirely, enter the “naked” domain here. Example:
Step 3: Use the debug tool to confirm correct pattern
If you want to double-check that your share recovery is set up properly, simply use our
?swp_cache=rebuild&swp_recovery_debug=true
string on any post permalink to see what alternate permalink is being tracked.
So, for example you would check
http://yourdomain.com/post-name/?swp_cache=rebuild&swp_recovery_debug=true
then view the page source (right-click > View Source) and search for swp_recovery_url
. The URL shown should be the exact URL of the previous structure, AKA the URL that you want to get the shares from.
Recovering from a Specific URL Manually
If you’ve changed the URL for a specific post or page that doesn’t fit the pattern in your Share Recovery settings, you can follow a few steps to set the previous/recovery URL manually:
- In Social Warfare > Advanced > Share Recovery, turn the toggle ON if you haven’t already. If you haven’t changed your permalinks or added SSL, you don’t need to fill in any other recovery settings.
- Edit a post (or page) and click on Screen Options in the top right corner, just under the top admin bar
- Check the box for Custom Fields, then click Screen Options again to close the toggle (you should only have to do this once)
- Scroll down past the normal editor box and look for the custom fields section
- You’ll see a bunch of fields – just scroll past them all until you see the Add New Custom Field section at the bottom of the list. Click the Enter New link on the left.
- Enter
swp_recovery_url
in the field on the left and the old URL on the right. (see an example) - Click the Add Custom Field button
- Save/update the post
Once you’ve done that, go view the post and add
?swp_cache=rebuild&swp_recovery=debug
to the end of the URL in your address bar, then hit Enter. That will force the count to update immediately (it will also update on its own within 48 hours if you don’t have time to go through and refresh manually).
Final Notes
You will need to keep share recovery activated for Social Warfare to continue adding the counts together. Actually, Social Warfare has a setting built in that won’t allow it to display counts if it fetches counts that are lower than it previously fetched. This is because every once in a while the API share count request fails and it ends up returning the number zero. However, if it fetches the number zero and it previously fetched the number 10, then we simply keep using the number 10.
With this in mind, here’s how it would turn out if you activate share recovery long enough to recover shares and then simply turn it back off:
- Activate share recovery function
- 10 (current URL) + 10 (former URL) = 20 shares
- Deactivate share recovery function
- Fetch 15 (current URL). Less than prev. Show 20
- Fetch 18 (current URL). Less than prev. Show 20
- Fetch 25 (current URL). More than prev. Show 25
- Activate custom recovery function
- Fetch 25 (current URL) + 10 (former URL). Show 35
So just make sure if you do use the share recovery function on your site that you remember to keep it turned on afterwards.
Conclusion
These settings should cover just about any possible scenario for permalink or URL changes to your Social Warfare enabled site. Please note that if you ever deactivate or remove Social Warfare from your site, your recovered counts will be lost. However, as long as Social Warfare is activated, your recovered counts are safe.
If you still have questions about how this function works, feel free to reach out to our Support team.