mirror of https://github.com/zulip/zulip.git
google_analytics: Track realm registration separately from user signup.
While the function which processes the realm registration and signup remains the same, we use different urls and functions to call the process so that we can separately track them. This will help us know the conversion rate of realm registration after receiving the confirmation link.
This commit is contained in:
parent
6a4c12b41e
commit
c928c87645
|
@ -13,7 +13,7 @@ requisite context to make a useful signup form. Therefore, we immediately
|
||||||
post to another view which executes in our code to produce the desired form.
|
post to another view which executes in our code to produce the desired form.
|
||||||
#}
|
#}
|
||||||
|
|
||||||
<form id="register" action="/accounts/register/" method="post">
|
<form id="register" action="{{ registration_url }}" method="post">
|
||||||
{{ csrf_input }}
|
{{ csrf_input }}
|
||||||
<input type="hidden" value="{{ key }}" name="key"/>
|
<input type="hidden" value="{{ key }}" name="key"/>
|
||||||
<input type="hidden" value="1" name="from_confirmation"/>
|
<input type="hidden" value="1" name="from_confirmation"/>
|
||||||
|
|
|
@ -306,7 +306,7 @@ class TestGenerateRealmCreationLink(ZulipTestCase):
|
||||||
|
|
||||||
# Bypass sending mail for confirmation, go straight to creation form
|
# Bypass sending mail for confirmation, go straight to creation form
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response('action="/accounts/register/"', result)
|
self.assert_in_response('action="/realm/register/"', result)
|
||||||
|
|
||||||
# Original link is now dead
|
# Original link is now dead
|
||||||
result = self.client_get(generated_link)
|
result = self.client_get(generated_link)
|
||||||
|
|
|
@ -3625,7 +3625,7 @@ class RealmCreationTest(ZulipTestCase):
|
||||||
"key": find_key_by_email(email),
|
"key": find_key_by_email(email),
|
||||||
"from_confirmation": "1",
|
"from_confirmation": "1",
|
||||||
}
|
}
|
||||||
result = self.client_post("/accounts/register/", payload)
|
result = self.client_post("/realm/register/", payload)
|
||||||
# Assert that the form did not prompt the user for enabling
|
# Assert that the form did not prompt the user for enabling
|
||||||
# marketing emails.
|
# marketing emails.
|
||||||
self.assert_not_in_success_response(['input id="id_enable_marketing_emails"'], result)
|
self.assert_not_in_success_response(['input id="id_enable_marketing_emails"'], result)
|
||||||
|
|
|
@ -116,14 +116,24 @@ def get_prereg_key_and_redirect(
|
||||||
accidentally adding an extra character after pasting).
|
accidentally adding an extra character after pasting).
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
check_prereg_key(request, confirmation_key)
|
prereg_user = check_prereg_key(request, confirmation_key)
|
||||||
except ConfirmationKeyError as e:
|
except ConfirmationKeyError as e:
|
||||||
return render_confirmation_key_error(request, e)
|
return render_confirmation_key_error(request, e)
|
||||||
|
|
||||||
|
realm_creation = prereg_user.realm_creation
|
||||||
|
|
||||||
|
registration_url = reverse("accounts_register")
|
||||||
|
if realm_creation:
|
||||||
|
registration_url = reverse("realm_register")
|
||||||
|
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"confirmation/confirm_preregistrationuser.html",
|
"confirmation/confirm_preregistrationuser.html",
|
||||||
context={"key": confirmation_key, "full_name": full_name},
|
context={
|
||||||
|
"key": confirmation_key,
|
||||||
|
"full_name": full_name,
|
||||||
|
"registration_url": registration_url,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -150,8 +160,17 @@ def check_prereg_key(request: HttpRequest, confirmation_key: str) -> Preregistra
|
||||||
|
|
||||||
@add_google_analytics
|
@add_google_analytics
|
||||||
@require_post
|
@require_post
|
||||||
|
def realm_register(*args: Any, **kwargs: Any) -> HttpResponse:
|
||||||
|
return registration_helper(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
@require_post
|
||||||
|
def accounts_register(*args: Any, **kwargs: Any) -> HttpResponse:
|
||||||
|
return registration_helper(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def accounts_register(
|
def registration_helper(
|
||||||
request: HttpRequest,
|
request: HttpRequest,
|
||||||
key: str = REQ(default=""),
|
key: str = REQ(default=""),
|
||||||
timezone: str = REQ(default="", converter=to_timezone_or_empty),
|
timezone: str = REQ(default="", converter=to_timezone_or_empty),
|
||||||
|
|
|
@ -127,6 +127,7 @@ from zerver.views.registration import (
|
||||||
get_prereg_key_and_redirect,
|
get_prereg_key_and_redirect,
|
||||||
new_realm_send_confirm,
|
new_realm_send_confirm,
|
||||||
realm_redirect,
|
realm_redirect,
|
||||||
|
realm_register,
|
||||||
signup_send_confirm,
|
signup_send_confirm,
|
||||||
)
|
)
|
||||||
from zerver.views.report import (
|
from zerver.views.report import (
|
||||||
|
@ -579,6 +580,7 @@ i18n_urls = [
|
||||||
name="new_realm_send_confirm",
|
name="new_realm_send_confirm",
|
||||||
),
|
),
|
||||||
path("accounts/register/", accounts_register, name="accounts_register"),
|
path("accounts/register/", accounts_register, name="accounts_register"),
|
||||||
|
path("realm/register/", realm_register, name="realm_register"),
|
||||||
path(
|
path(
|
||||||
"accounts/do_confirm/<confirmation_key>",
|
"accounts/do_confirm/<confirmation_key>",
|
||||||
get_prereg_key_and_redirect,
|
get_prereg_key_and_redirect,
|
||||||
|
|
Loading…
Reference in New Issue