I would suggest the following patch for the amazon sidebar plugin.
Code: Select all
Binary files serendipity_plugin_amazon/.DS_Store and neu_serendipity_plugin_amazon/.DS_Store differ
diff -rNu serendipity_plugin_amazon/lang_en.inc.php neu_serendipity_plugin_amazon/lang_en.inc.php
--- serendipity_plugin_amazon/lang_en.inc.php 2009-09-13 02:30:42.000000000 +0700
+++ neu_serendipity_plugin_amazon/lang_en.inc.php 2011-07-31 14:58:00.000000000 +0700
@@ -11,6 +11,8 @@
@define('PLUGIN_AMAZON_PROP_TITLE', "Title");
@define('PLUGIN_AMAZON_PROP_TITLE_DESC', "Title to display in the Sidebar");
@define('PLUGIN_AMAZON_NEW_WINDOW', "Open links in new windows");
+@define('PLUGIN_AMAZON_TRACK_GOOGLE', "Track Clicks using Google Analytics");
+@define('DESC_PLUGIN_AMAZON_TRACK_GOOGLE', "Google Analytics Plugin needed.");
@define('PLUGIN_AMAZON_SMALL_MED', "Thumbnail size to display");
@define('PLUGIN_AMAZON_SMALL', "Small");
@define('PLUGIN_AMAZON_MEDIUM', "Medium");
diff -rNu serendipity_plugin_amazon/serendipity_plugin_amazon.php neu_serendipity_plugin_amazon/serendipity_plugin_amazon.php
--- serendipity_plugin_amazon/serendipity_plugin_amazon.php 2009-10-05 02:31:12.000000000 +0700
+++ neu_serendipity_plugin_amazon/serendipity_plugin_amazon.php 2011-07-31 14:58:00.000000000 +0700
@@ -19,10 +19,10 @@
function introspect(&$propbag) {
$propbag->add('name', PLUGIN_AMAZON_TITLE);
$propbag->add('description', PLUGIN_AMAZON_DESC);
- $propbag->add('configuration', array('title','server', 'newwindows', 'small_medium_large','button','asin','cnt','cache'));
+ $propbag->add('configuration', array('title','server', 'newwindows', 'small_medium_large','button','asin','cnt','cache','tracking'));
$propbag->add('author', 'Matthew Groeninger, (original plugin by Thomas Nesges)');
$propbag->add('stackable', true);
- $propbag->add('version', '1.21');
+ $propbag->add('version', '1.22');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
@@ -92,6 +92,12 @@
$propbag->add('radio_per_row', '1');
$propbag->add('default', 'small');
break;
+ case 'tracking':
+ $propbag->add('type', 'boolean');
+ $propbag->add('name', PLUGIN_AMAZON_TRACK_GOOGLE);
+ $propbag->add('description', DESC_PLUGIN_AMAZON_TRACK_GOOGLE);
+ $propbag->add('default', false);
+ break;
default:
return false;
@@ -146,6 +152,7 @@
} else {
$content_out = $content;
}
+ $content_out = str_replace('&', '&', $content_out);
echo $content_out;
}
@@ -171,14 +178,18 @@
if ($this->get_config('newwindows')) {
$target = ' target="_new" ';
}
+ $google_tracking = '';
+ if ($this->get_config('tracking') && class_exists('serendipity_event_google_analytics')) {
+ $google_tracking = "onclick=\"_gaq.push(['_trackEvent', 'Amazon', 'Click', '" . $strings['title'] . "']);\"";
+ }
$file_size = $this->get_config('small_medium_large','smallurl');
$content = '<div class="amazon_sidebar">';
if (isset($strings["$file_size"])) {
- $content .= '<a href="'.$strings['DETAILPAGEURL'].'" '.$target.'><img src="'.$strings["$file_size"].'"/></a>';
+ $content .= '<a ' . $google_tracking . 'href="'.$strings['DETAILPAGEURL'].'" '.$target.'><img src="'.$strings["$file_size"].'"/></a>';
} else {
- $content .= '<a href="'.$strings['DETAILPAGEURL'].'" '.$target.'>'.PLUGIN_EVENT_AMAZONCHOOSER_NOIMAGE.'</a>';
+ $content .= '<a ' . $google_tracking . 'href="'.$strings['DETAILPAGEURL'].'" '.$target.'>'.PLUGIN_EVENT_AMAZONCHOOSER_NOIMAGE.'</a>';
}
- $content .= '<div class="amazon_sidebar_details"><a href="'.$strings['DETAILPAGEURL'].'" '.$target.'>'.$strings['title'].'</a></div>';
+ $content .= '<div class="amazon_sidebar_details"><a ' . $google_tracking . 'href="'.$strings['DETAILPAGEURL'].'" '.$target.'>'.$strings['title'].'</a></div>';
$content .= '</div>';
if (class_exists('Cache_Lite') && is_object($cache_obj)) {
$cache_obj->save($content,'amazonsidebar_'.$asin);
Daniel