4 Steps to Add Real-Time Download.com User Ratings as Rich Snippets

By Janet Driscoll Miller | Dec 29, 2010
More Articles by Janet


If your company sells client-based software, you’re no doubt familiar with CNET’s Download.com site. Download.com offers free downloads of over 100,000 software titles for free trials, freeware and shareware. Additionally, some software titles receive reviews from CNET editors, and all titles are eligible to receive user-based ratings.

If you have a product that is highly rated by users on Download.com, you may want to share that information on a broader spectrum. In four simple steps, you can add your Download.com user ratings as Google rich snippets so that your user ratings show in Google’s web results. Here’s how:

Step 1: Get an API Key

If you don’t have one already, you’ll need to get a CNET API key. It’s free and easy to do — just fill out the application and you’ll receive a key within minutes.

Step 2: Find Your Product ID

Next, you’ll need your product ID for this software. If you don’t know it, an easy way to find it is to search for the product name on Download.com. Then right click on the “Download Now” link and copy the URL. Paste the URL in Notepad and look for the “pid” value in the URL. This is the product ID for this product.

Step 3: Add the Code to Your Page

You’ll then need to add the XML-parsing code to your web page. You can do this with a number of different programming languages, but you’ll need to use a server-side language, such as PHP. Client-side languages, like Javascript, will not work. In the example below, I used PHP to parse the XML data and enter it into Google’s rich snippet code:

<div xmlns:v=”http://rdf.data-vocabulary.org/#” typeof=”v:Review-aggregate”>

<span property=”v:itemreviewed”>[product name here]</span>

<span rel=”v:rating”>

<span typeof=”v:Rating”>

<span property=”v:average”>

<?php

$doc = new DOMDocument();

$doc->load(‘http://developer.api.cnet.com/rest/v1.0/softwareProduct?iod=breadcrumb%2CuserRatings&productId=[product ID here]&partTag=[API key here]‘);

$arrFeeds = array();

foreach ($doc->getElementsByTagName(‘UserRatingSummary’) as $node) {

$itemRSS = array (

‘rating’ => $node->getElementsByTagName(‘Rating’)->item(0)->nodeValue,

‘totalvotes’ => $node->getElementsByTagName(‘TotalVotes’)->item(0)->nodeValue,

);

array_push($arrFeeds, $itemRSS);

}

$rating = $node->getElementsByTagName(‘Rating’)->item(0)->nodeValue;

$votes = $node->getElementsByTagName(‘TotalVotes’)->item(0)->nodeValue;

echo $rating;

?>

</span> out of <span property=’v:best’>5</span>

</span>

</span> based on <span property=’v:votes’><? echo $votes;?></span> ratings.<span property=’v:count’><?echo $votes;?></span> user reviews

</div>

Replace the areas marked in red with the appropriate data.

Step 4: Test Your Rich Snippets

Once you’ve added the code and your page is live on a server, you can test your rich snippets using Google’s rich snippet testing tool. Just enter the URL of your page and, if the rich snippet code is correct, Google will demonstrate how the rich snippet will appear in search results. Voila! You’re done!

Remember: You can use rich snippets on every product page, because you may have multiple product pages that rank in Google for a particular product. So be sure to add the rich snippet code to every page that pertains to that piece of software, including the overview page, the download page, the pricing page, etc.

Also, if you have a product reviewed by CNET but NOT on Download.com, such as a tech product, the same type of approach as the code above works. However, you’ll need to make sure you locate the proper product ID and also use the appropriate XML reference, which you can find by clicking here.

Share this article

Share on LinkedIn Share on Twitter

Blog Search


Receive Daily Digital Marketing Tips

Subscribe to monthly updates from the Marketing Mojo Blog to get the latest digital marketing tips, best practices and insights - hot off the presses and straight to your inbox!