From 2de3a66c8c27d4ef0d6fb155b5159c7af2d99d91 Mon Sep 17 00:00:00 2001
From: Matthieu Aubry <mattab@users.noreply.github.com>
Date: Thu, 8 Dec 2016 10:26:41 +1300
Subject: [PATCH] Display tooltip introducing Funnels in the goal editor 
 (#10981)

---
 plugins/Feedback/templates/index.twig          |  2 +-
 plugins/Goals/templates/addNewGoal.twig        |  1 +
 .../tests/System/Api/ClientTest.php            |  1 +
 .../ProfessionalServices.php                   | 18 ++++++++++++++++++
 plugins/ProfessionalServices/Promo.php         |  8 ++++++++
 5 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/plugins/Feedback/templates/index.twig b/plugins/Feedback/templates/index.twig
index b729b6b96f..80d7d0350f 100644
--- a/plugins/Feedback/templates/index.twig
+++ b/plugins/Feedback/templates/index.twig
@@ -59,7 +59,7 @@
             <p>Grow your business, understand your audience better and increase your sales and conversions with a premium plugin for Piwik:
             <p>   &bull;  <a rel='noreferrer' target='_blank' href='https://piwik.org/recommends/ab-testing-learn-more/'>A/B Testing Platform for Piwik Analytics</a>.
             </p>
-            <p>   &bull;  <a rel='noreferrer' target='_blank' href='https://plugins.piwik.org/Funnels'>Conversion Funnels</a>.
+            <p>   &bull;  <a rel='noreferrer' target='_blank' href='https://piwik.org/recommends/conversion-funnels'>Conversion Funnels</a>.
             </p>
             <p>   &bull;  <a rel='noreferrer' target='_blank' href='https://piwik.org/recommends/media-analytics-website/'>Powerful Video Analytics and Audio Analytics</a>.
             </p>
diff --git a/plugins/Goals/templates/addNewGoal.twig b/plugins/Goals/templates/addNewGoal.twig
index 9b7819d7f9..ae57805f3c 100644
--- a/plugins/Goals/templates/addNewGoal.twig
+++ b/plugins/Goals/templates/addNewGoal.twig
@@ -17,5 +17,6 @@
             {{ 'Goals_LearnMoreAboutGoalTrackingDocumentation'|translate("<a href='?module=Proxy&action=redirect&url=http://piwik.org/docs/tracking-goals-web-analytics/' target='_blank'>","</a>")|raw }}
         </p>
     </div>
+    {{ postEvent("Template.afterGoalCannotAddNewGoal") }}
 
 {% endif %}
diff --git a/plugins/Marketplace/tests/System/Api/ClientTest.php b/plugins/Marketplace/tests/System/Api/ClientTest.php
index e38fb809e1..8c3616321f 100644
--- a/plugins/Marketplace/tests/System/Api/ClientTest.php
+++ b/plugins/Marketplace/tests/System/Api/ClientTest.php
@@ -79,6 +79,7 @@ class ClientTest extends SystemTestCase
             'shop',
             'versions',
             'isDownloadable',
+            'changelog',
             'consumer');
 
         $this->assertNotEmpty($plugin);
diff --git a/plugins/ProfessionalServices/ProfessionalServices.php b/plugins/ProfessionalServices/ProfessionalServices.php
index 2dd0811b6b..8dafa079bd 100644
--- a/plugins/ProfessionalServices/ProfessionalServices.php
+++ b/plugins/ProfessionalServices/ProfessionalServices.php
@@ -21,6 +21,8 @@ class ProfessionalServices extends \Piwik\Plugin
             'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
             'Request.getRenamedModuleAndAction' => 'renameProfessionalServicesModule',
             'Template.afterGoalConversionOverviewReport' => array('function' => 'getGoalOverviewPromo', 'after' => true),
+            'Template.afterGoalCannotAddNewGoal' => array('function' => 'getGoalOverviewPromo', 'after' => true),
+            'Template.endGoalEditTable' => array('function' => 'getGoalFunnelOverviewPromo', 'after' => true),
             'Template.afterEventsReport' => 'getEventsPromo',
         );
     }
@@ -56,6 +58,22 @@ class ProfessionalServices extends \Piwik\Plugin
         return $isWidget;
     }
 
+    public function getGoalFunnelOverviewPromo(&$out)
+    {
+        if(\Piwik\Plugin\Manager::getInstance()->isPluginActivated('Funnels')
+            || $this->isRequestForDashboardWidget()) {
+            return;
+        }
+
+        $out .= '
+            <p style="margin-top:3em;margin-bottom:3em" class=" alert-info alert">Did you know?
+                A Funnel defines a series of actions that you expect your visitors to take on their way to converting a goal.
+                <br/>With <a target="_blank" rel="noreferrer" href="https://piwik.org/recommends/conversion-funnel/">Funnels for Piwik</a>,
+                you can easily determine your funnel and see where your visitors drop off and how to focus efforts to increase your conversions.
+            </p>';
+    }
+
+
     public function getGoalOverviewPromo(&$out)
     {
         if(\Piwik\Plugin\Manager::getInstance()->isPluginActivated('AbTesting')
diff --git a/plugins/ProfessionalServices/Promo.php b/plugins/ProfessionalServices/Promo.php
index afbe6d0bd0..630b2c98c0 100644
--- a/plugins/ProfessionalServices/Promo.php
+++ b/plugins/ProfessionalServices/Promo.php
@@ -44,6 +44,13 @@ class Promo
                 'text' => 'Get powerful insights into how your audience watches your videos and listens to your audio. Media Analytics is now available on the Marketplace.',
             ),
 
+            // Funnels
+            array(
+                'campaignContent' => 'funnels',
+                'url' => 'https://piwik.org/recommends/conversion-funnels',
+                'text' => 'Increase your conversions, sales and revenue by understanding your conversion funnels and where your visitors drop off with Funnels for Piwik.'
+            ),
+
             // Piwik training
             array(
                 'campaignContent' => 'userTraining',
@@ -52,6 +59,7 @@ class Promo
             ),
 
 
+
             // Piwik PRO
             // https://piwik.org/recommends/piwik-pro-from-app
             array(
-- 
GitLab