]> git.openstreetmap.org Git - rails.git/commitdiff
Add support for manual tracking of a Piwik goal on signup
authorTom Hughes <tom@compton.nu>
Tue, 20 Sep 2011 20:40:53 +0000 (21:40 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 20 Sep 2011 20:40:53 +0000 (21:40 +0100)
app/controllers/user_controller.rb
app/views/layouts/_piwik.html.erb
config/example.application.yml

index 70328f5a5d637f3f1b6b2116d697692e28caf0c3..9c5ac0d09edf8bf400c196cb14b3ec3d54096082 100644 (file)
@@ -128,6 +128,7 @@ class UserController < ApplicationController
       @user.openid_url = nil if @user.openid_url and @user.openid_url.empty?
       
       if @user.save
       @user.openid_url = nil if @user.openid_url and @user.openid_url.empty?
       
       if @user.save
+        flash[:piwik_goal] = PIWIK_SIGNUP_GOAL if defined?(PIWIK_SIGNUP_GOAL)
         flash[:notice] = t 'user.new.flash create success message', :email => @user.email
         Notifier.deliver_signup_confirm(@user, @user.tokens.create(:referer => session.delete(:referer)))
         session[:token] = @user.tokens.create.token
         flash[:notice] = t 'user.new.flash create success message', :email => @user.email
         Notifier.deliver_signup_confirm(@user, @user.tokens.create(:referer => session.delete(:referer)))
         session[:token] = @user.tokens.create.token
index 59017e0b77d37744c639a5bd005a983b30457f18..0b719932d1caf004123e73db3f53a505e3d54d84 100644 (file)
@@ -7,6 +7,9 @@ try {
 var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", <%= PIWIK_SITE %>);
 piwikTracker.trackPageView();
 piwikTracker.enableLinkTracking();
 var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", <%= PIWIK_SITE %>);
 piwikTracker.trackPageView();
 piwikTracker.enableLinkTracking();
+<% if flash[:piwik_goal] -%>
+piwikTracker.trackGoal(<%= flash[:piwik_goal] %>);
+<% end -%>
 } catch( err ) {}
 </script><noscript><p><img src="http://<%= PIWIK_LOCATION %>/piwik.php?idsite=<%= PIWIK_SITE %>" style="border:0" alt="" /></p></noscript>
 <!-- End Piwik Tracking Code -->
 } catch( err ) {}
 </script><noscript><p><img src="http://<%= PIWIK_LOCATION %>/piwik.php?idsite=<%= PIWIK_SITE %>" style="border:0" alt="" /></p></noscript>
 <!-- End Piwik Tracking Code -->
index f4a369487441054529f6f6a03924b87bc14f5974..3c5b3a3e9691f516ec527076673d88e26771be36 100644 (file)
@@ -76,6 +76,7 @@ standard_settings: &standard_settings
   # Piwik details
   #piwik_location: "piwik.openstreetmap.org"
   #piwik_site: 1
   # Piwik details
   #piwik_location: "piwik.openstreetmap.org"
   #piwik_site: 1
+  #piwik_signup_goal: 1
 
 development:
   <<: *standard_settings
 
 development:
   <<: *standard_settings