
Insight have recently started using Managed Units on Easy Content Units (ECU). We highly recommend that you use these great content units as they are a fantastic way to easily integrate our products into your existing website.
There are currently 2 methods to embed the Content Units into your website. JavaScript, or PHP. The JavaScript method is the easiest but is not the best as Search Engines cannot index JavaScript. If you have the technical skills, you can drop the PHP code that ECU supply directly into your website. This allows search engines to know what products you are offering. However, there is still the downside that for every product you promote you have an external link to easycontentunits.com. This is generally bad SEO practice as every external link is a drop in page rank. Thankfully, ECU provide the ‘rel=”nofollow”‘ code in the anchor tags, so you shouldn’t be penalised too much, if at all. In addition, most PHP servers have a security setting which prevent this code from running.
There is the fact that some folks just prefer to see that the links are on their own website, rather than an external website. For this reason, I’ve come up with a different bit of PHP code. If you use the PHP code supplied by ECU; then I’d highly recommend you implement this code. The code is as follows and goes wherever you want the content unit.
/*
Retrieve HTML for Easycontentunits.com product unit.
Note: 'fopen wrappers' must be enabled. Requires PHP 4.3.0. or above.
*/
/*
Code by Bob DeVeaux for ECU
This re-writes the ECU link to the same domain as the code
*/
// function for downloading file
function curl_get_file_contents($URL)
{
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 5000);
curl_setopt($c, CURLOPT_TIMEOUT, 10000);
$contents = curl_exec($c);
curl_close($c);
if ($contents)
{
return $contents;
}
else
{
return false;
}
}
$ecu_mid = 839; // your member id
$ecu_uid = 20212; // your unit id
$ecu_tracking = ''; // optional tracking id
$ecu_keywords = ''; // optional keywords for random product unit
$ecu_debug_mode = 'no'; // debug mode (yes or no)
$domain = "http://".$_SERVER["HTTP_HOST"];
$path = '/blog';
$ecu_url =
'http://www.easycontentunits.com/phpunit.php?ecu_mid='.$ecu_mid
.'&ecu_uid='.$ecu_uid.'&ecu_tracking='.urlencode($ecu_tracking).
'&ecu_keywords='.urlencode($ecu_keywords).'&debug='.$ecu_debug_mode;
// cURL download file.
if($content = curl_get_file_contents($ecu_url))
{
$content = str_replace('href="http://www.easycontentunits.com',
'href="'.$domain.$path, $content);
print $content;
}
You then need your own version of product.php in the location you specified for ‘$path’.
$domain = "http://".$_SERVER["HTTP_HOST"];
$qs = explode('product.php', $_SERVER['REQUEST_URI']);
$url = 'http://www.easycontentunits.com/product.php'.$qs[1];
header('HTTP/1.1 301 Moved Permanently');
header("Location: ".$url);
The final step is to prevent search engines from spidering the redirect page by editing your robots.txt.
Disallow: /PATH_HERE/product.php
To see it action: http://blog.insight.com/blog/ecu.php
If you have any questions drop me an email: bob.deveaux@insight.com
Hope you enjoyed the article!















