Remove Flash Tracking from AddThis module on Drupal 5

2009
30
Oct

If you use AddThis module on drupal, you might have noticed that a 1px by 1px flash object is created which sets tracking cookies on your pages. This is transparent to the user most time and you will see it only under generated source view. The flash button is added dynamically by the addThis module on the top of the page. This sometimes can be annoying since a white bar can appear at the top of the page due to this.

In drupal 6, the flash tracking can be disabled. In drupal 5 the tracking can be disabled by adding the following line of code to addthis.module
addthis_disable_flash = true; to the function _addthis_create_button so that the function is as shown below

function _addthis_create_button($node=NULL, $teaser = FALSE) {
  global $addthis_counter;
  $addthis_counter++;
  if ($addthis_counter == 1) {
	  drupal_add_css((drupal_get_path('module', 'addthis') .'/addthis.css'));
	  drupal_add_js(sprintf('
	    addthis_pub = \'%s\';
	    addthis_logo = \'%s\';
	    addthis_logo_background = \'%s\';
	    addthis_logo_color = \'%s\';
	    addthis_brand = \'%s\';
	    addthis_options = \'%s\';
      addthis_disable_flash = true;
/*
	    addthis_offset_top = \'%d\';
	    addthis_offset_left = \'%d\';
*/
	',
	    variable_get('addthis_username', 'my-username'),
	    variable_get('addthis_logo', 'http://www.addthis.com/images/yourlogo.png'),
	    variable_get('addthis_logo_background', 'EFEFFF'),
	    variable_get('addthis_logo_color', '666699'),
	    variable_get('addthis_brand', 'Your Site'),
	    variable_get('addthis_options', 'favorites, email, digg, delicious, myspace, facebook, google, live, more'),
	    variable_get('addthis_offset_top', '2'),
	    variable_get('addthis_offset_left', '2')
	  ), 'inline');
  }
 
  return ( sprintf('
    <div class="addthis"><a href="http://www.addthis.com/bookmark.php"
      onmouseover="return addthis_open(this, \'\', \'%s\', \'%s\')"
      onmouseout="addthis_close()"
      onclick="return addthis_sendto()"><img src="%s" width="%d" height="%d" %s /></a></div>
    <script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script>
    ',
    $teaser ? url('node/'.$node->nid, array('absolute' => 1) ) : '[URL]',
    $teaser ? addslashes($node->title) : '[TITLE]',
    variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif'),
    variable_get('addthis_image_width', '125'),
    variable_get('addthis_image_height', '16'),
    variable_get('addthis_image_attributes', 'alt=""')
  ));
}

Similar Posts
Related Searches




Comments

Post new comment

The content of this field is kept private and will not be shown publicly.