diff --git a/plugins/Goals/Goals.php b/plugins/Goals/Goals.php
index <HASH>..<HASH> 100644
--- a/plugins/Goals/Goals.php
+++ b/plugins/Goals/Goals.php
@@ -41,11 +41,21 @@ class Piwik_Goals extends Piwik_Plugin
 			'API.getReportMetadata.end' => 'getReportMetadata',
 			'WidgetsList.add' => 'addWidgets',
 			'Menu.add' => 'addMenus',
+			'SitesManager.deleteSite' => 'deleteSiteGoals',
 		);
 		return $hooks;
 	}
 
 	/**
+	 * Delete goals recorded for this site
+	 */
+	function deleteSiteGoals($notification )
+	{
+		$idSite = &$notification->getNotificationObject();
+		Piwik_Query("DELETE FROM ".Piwik_Common::prefixTable('goal') . " WHERE idsite = ? ", array($idSite));
+	}
+	
+	/**
 	 * Returns the Metadata for the Goals plugin API.
 	 * The API returns general Goal metrics: conv, conv rate and revenue globally 
 	 * and for each goal.
Fixes #<I> Now, every entity linked to a site is deleted when a site is deleted.
Only the logs and archives are not deleted, because it could result in severe data loss. Better deal with this later on..

git-svn-id: <URL>