From c31856b40b4f49e17c7e5402e93115fce5a75c66 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Mon, 12 Nov 2007 10:51:31 +0000 Subject: [PATCH] Added some code to support Google's conversion tracking. --- controller/Notebooks.py | 8 ++++++++ view/Main_page.py | 13 +++++++++++++ view/Notebook_rss.py | 1 + 3 files changed, 22 insertions(+) diff --git a/controller/Notebooks.py b/controller/Notebooks.py index 9f86db8..211c246 100644 --- a/controller/Notebooks.py +++ b/controller/Notebooks.py @@ -79,6 +79,14 @@ class Notebooks( object ): if revision: result[ "note_read_write" ] = False + # if the user doesn't have any storage bytes yet, they're a new user, so see what type of + # conversion this is (demo or signup) + if result[ "user" ].storage_bytes == 0: + if u"demo" in [ note.title for note in result[ "startup_notes" ] ]: + result[ "conversion" ] = u"demo" + else: + result[ "conversion" ] = u"signup" + return result def contents( self, notebook_id, note_id = None, revision = None, user_id = None ): diff --git a/view/Main_page.py b/view/Main_page.py index 539c7f8..6070d8b 100644 --- a/view/Main_page.py +++ b/view/Main_page.py @@ -26,6 +26,7 @@ class Main_page( Page ): start = None, count = None, http_url = None, + conversion = None, ): startup_note_ids = [ startup_note.object_id for startup_note in startup_notes ] @@ -74,6 +75,14 @@ class Main_page( Page ): else: notebook_path = u"/notebooks/%s" % notebook.object_id + conversion_html = None + + if conversion: + try: + conversion_html = file( u"static/html/%s_conversion.html" % conversion ).read() + except IOError: + pass + Page.__init__( self, title, @@ -165,6 +174,10 @@ class Main_page( Page ): ), id = u"center_area", ), + Div( + conversion_html, + id = u"conversion_area", + ), id = u"everything_area", ), ) diff --git a/view/Notebook_rss.py b/view/Notebook_rss.py index 60c5950..dc6feb6 100644 --- a/view/Notebook_rss.py +++ b/view/Notebook_rss.py @@ -20,6 +20,7 @@ class Notebook_rss( Rss_channel ): start = None, count = None, http_url = u"", + conversion = None, ): if notebook.name == u"Luminotes": notebook_path = u"/"