The Complete Guide to Data Feed Sites marches on. If you’ve followed me this far, thanks for reading! You’re in for a nice treat in Part 4. In this post I’m going to give you a custom script. Great success!
CTRtard’s ShareASale Site Builder
- Build a complete data feed site from any ShareAsale data feed in minutes.
- Posts remotely to your WordPress sites so you install it one time and build out sites from a central location.
- Contains a simple Templating System that lets you edit a single file using basic HTML to get your posts to look just like you want them.
- Ability to Drip Posts so your data feed site will get built out slowly over time. This will help indexing and ranking by encouraging spiders to visit your site frequently as new posts (feed items) get added daily.
- Ability to Preview a Feed in an easy to read format so you can judge feed content and quality.
- Ability to Preview Categorization. Easily see item counts for each category so you can quickly tell how well a feed is categorized.
- Ability to Preview what your WordPress posts will look like.
- Ability to Ignore specific Categories and Sub Categories.
- Un-protected source code allows easy customization and ability to tie it in to other content generators you may have.
- 100% Free!
You can put the script files on pretty much any hosting account. You can even run it from your local machine if you’ve got a PHP web server setup. (BTW, if you want a super easy to use package for Windows, I recommend WampServer, it’s great!)
The script works by making remote posts to your WordPress blog using the XML-RPC capabilities built in to WordPress. This means, unlike data feed “plugins” on the market, it does NOT have to be on the same machine/hosting account or be added to each WP site. Time saver!
So ideally, you want to put the script in one place and use it from there for all your successive data feed sites building.
Setup Your WordPress Site
Login to your target site (the WordPress site that will be your data feed site) and under Settings > Writing, tick the Enable XML-RPC checkbox. If you haven’t already done so, now is the time to install the recommended data feed site plugins and configure them.
Adjust Script Setttings
The first thing you need to do is get a .csv file for the ShareASale data feed you want to use. Download and unzip the file and upload it to the script directory. Note the name of the file. It should be [merchant_id].txt (e.g. 12345.txt)
Next, open up the script file “shareasale.php” in your editor. This is the main script. You’re going to need to adjust some settings.
Fill out the section “// WordPress Login Details” appropriately. Regarding the $xmlrpc_url value, you should just adjust it for your domain name. To make sure you’ve got it right, you can paste your URL in your browser for testing (e.g. “http://yourdomain.com/xmlrpc.php”) If your URL is correct and you’ve setup WordPress right, you should see the message “XML-RPC server accepts POST requests only.” appear in your browser.
Under “// Data Feed .csv File Details” section, change the value of $feed_file so it matches the filename of the csv you uploaded previously. $your_user_id is your ShareASale user id. You can see your ID at the top of the page when you log in to ShareASale. The value of $template is the file used as a post template. The default works fine, details on how to edit/change that are below.
Under “// Row Control”, you can limit which records in the data feed you want to use. This is very useful when you are first just checking out a feed. Some feeds are very large and having a way to just look at chunks of it will make your life easier.
$max_days_in_future allows you to configure how far into the future you want posts to be made. The script uses WordPress’s post scheduling function to make this work. So you run the script once when you build your site and your actual WordPress site will drip your posts according to the schedules that you’ve set. Set and forget. Sweet!
The script has 4 modes. All of these modes are affected by the “Row Control” settings mentioned above. So to limit the output or run through the whole data feed, you’ll need to adjust these settings.
Mode 0 CSV Preview Mode: Use this option to see exactly what the csv file contains. This is useful to do first so you can see which fields you want to incorporate into your data feed site.
Mode 1 CSV Preview Mode – Show Categories Only: Use this option to see a complete list of categories in the .csv file. This is useful in determining what type of categorization the data feed uses and how many records are in each category.
Mode 2 WordPress Post Preview Mode: Use this option to see what your posts will look like. This is useful in checking content formatting. Note: this just gives you a preview of the post title, body and basic formatting. It is not able to show you the *exact* look of the post because the WP theme you have chosen will be applying styles.
Mode 3 WordPress Post Mode: Use this option to make actual posts. Once you’ve checked your basic post formatting by using mode 2, you can use this option and the real posts will be made to your WordPress site.
Simple Template System
The file post-template.htm is the file you should edit to control how your posts look. Open it in an html editor and you will see it’s just some basic html. I chose to use tables, but if you’re one of “those people” who don’t like to use tables, knock yourself out and make your own file 😉
When you look over the html source, you’ll see tokens that will be replaced by the script. For example, anywhere the token [[Link]] appears, will be replaced by your actual ShareAsale affiliate link. The same goes for the other tokens. You can use tokens as often as you like.
These tokens are named exactly according to each field in the .csv file. The simple way to figure out what fields you want to use in your posts is to run the script in mode 0 (CSV Preview). You will see something like this:
Every field in the left column will work as a token if you just wrap it with a [[ and ]]. I can’t make it any simpler than that!
A Short Walk-through
I typically use the modes in order. I use mode 0 to decide if I even like the feed. Then I use mode 1 to get a handle on how well it’s categorized. If categorization sucks, I move on.
Based on what I see in mode 0 and mode 1, I edit my template to my liking. Every feed has different info, so taking the time to present the data in a useful way will definitely influence how well your site does. Everything else is being automated, so don’t get lazy! Take 10 minutes to format your posts.
Next, I run it in mode 2, so I can see the overall layout as it will appear in my posts. If this looks good, I do 10 posts by setting $row_start = 0 and $row_count = 9 using mode 3. I check the links on my blog, making sure everything looks good.
If everything checks out with my limited test posts, I let ‘er rip and set $row_count = 0 so the script will run through the entire feed. Taking the time to make sure things look OK is worth it. Otherwise, you might have to delete hundreds or thousands of posts on your blog and that sucks!
Step Up Your Game
The people who will get the most out of this script will be the ones who put some effort into being different. Re-read the previous posts in this series to refresh your memory, then go to town and mod the script.
Keep in mind, the biggest advantage to using my script is that you can customize the output. There are plenty of slick data feed plugins on the market, but they are very hands off and customization is hard or impossible. With this script, you are in control, so leverage that fact.
I’ve only scratched the surface here, and honestly this is one of those times you should just get your hands dirty.
Read through the source code. I put some comments here and there that indicate good places to add your own stuff. Ideally, you want to add some more content to each post.
Of particular note, is how to customize the post category. Line 209 is where the post category is built. By default it uses merchantCategory and merchantSubcategory. This may or may not work for your particular feed. So that’s one thing for sure you want to play with.
If you come up with some slick mods you want to share, shoot me an email or leave a comment. It would be cool to see this script improve with some more features.
This script is 100% free, it won’t cost you a dime. But I am reserving it as a thank you for joining my list. Joining only takes a minute, just fill out the form at the top right of this page. After you verify your email, you’ll get the script download link in your inbox. (If you’re already on my list, you should have the email already.)
Note: You have my word I’m NOT going to spam you weekly with crappy guru offers like most of the “super affiliate bloggers”. Believe me, I hate that shit as much as you do! In fact, chances are good you will rarely see an email from me unless I have something important to share.
This concludes the series: Data Feed Sites, A Complete Guide. I hope you guys enjoyed it. If I missed anything or you have questions, please post them in the comments — that way everyone can benefit from the discussion.