Using the ClickHeat Web Service on a Drupal Site

Using the ClickHeat Web Service on a Drupal Site

Since it doesn't look like there is currently a Drupal Module available yet for ClickHeat, I thought I'd just to a quick how-to integration until someone puts together a module for it (maybe me!):

  1. Download ClickHeat and unzip / unpack it.
  2. Upload the whole clickheat folder to your root web site folder
  3. Visit the clickheat folder in your browser, as in mysite.com/clickheat
  4. Follow the configuration instructions. It should then take you to the ClickHeat page which is displaying a little bit of the top of your homepage, with a link about adding javascript. Click the link.
  5. Fill out your preferences to create the javascript
  6. Copy the resulting javascript and paste it into the bottom of your theme's page.tpl.php page, right above the body tag

Now, you'll want to make it so that it will automatically know when it's on a separate page. The way to do this is to grab the $variables['title'] variable and make it your ClickHeat Group. On my page, I use the following code:

<?php $click_heat_title = str_replace("'",'"',$variables["title"]); ?>
<script type="text/javascript" src="http://www.mysite.com/clickheat/js/clickheat.js"></script><script type="text/javascript"><!--
clickHeatSite = 'ibd';clickHeatGroup = '<?php echo $click_heat_title;?>';clickHeatServer = 'http://www.mysite.com/clickheat/click.php';initClickHeat(); //-->
</script>

The only thing this code does is replace the single quotes in the title and replace them with double quotes, then sets it as the clickHeatGroup variable.

Heat maps in Drupal, super easy analytics!

In combination with Google Analytics, this should give you a pretty good overview of how best to optimize your site for more targeted clicks.

Discussion on this post:
Implied By Design Logo