Skip to content

Commit

Permalink
Add querystring test URL for fx firstrun. Bugs 901028, 909943.
Browse files Browse the repository at this point in the history
- Remove old A/B firstrun test URLs

- Remove B firstrun template

- Remove GA experiment code from /firefox/firstrun/

- Add GA experiment code to /firefox/new/
  • Loading branch information
jpetto committed Sep 4, 2013
1 parent b8b4ec8 commit b257564
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 204 deletions.
17 changes: 0 additions & 17 deletions bedrock/firefox/templates/firefox/firstrun.html
Expand Up @@ -14,23 +14,6 @@
{% block site_header_nav %}{% endblock %}
{% block site_header_logo %}{% endblock %}

{% block extrahead %}
<!-- Google Analytics Content Experiment code -->
<script>function utmx_section(){}function utmx(){}(function(){var
k='71153379-26',d=document,l=d.location,c=d.cookie;
if(l.search.indexOf('utm_expid='+k)>0)return;
function f(n){if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.
indexOf(';',i);return escape(c.substring(i+n.length+1,j<0?c.
length:j))}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;d.write(
'<sc'+'ript src="'+'http'+(l.protocol=='https:'?'s://ssl':
'://www')+'.google-analytics.com/ga_exp.js?'+'utmxkey='+k+
'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='+new Date().
valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
'" type="text/javascript" charset="utf-8"><\/sc'+'ript>')})();
</script><script>utmx('url','A/B');</script>
<!-- End of Google Analytics Content Experiment code -->
{% endblock %}

{% block site_css %}
{{ css('firefox_firstrun') }}
{% endblock %}
Expand Down
134 changes: 0 additions & 134 deletions bedrock/firefox/templates/firefox/firstrun/b.html

This file was deleted.

20 changes: 20 additions & 0 deletions bedrock/firefox/templates/firefox/new.html
Expand Up @@ -12,6 +12,26 @@
<h2><a href="{{ url('mozorg.home') }}"><img src="{{ MEDIA_URL }}img/firefox/new/header-firefox.png?2013-06" alt="{{_('Firefox for desktop')}}" /></a></h2>
{% endblock %}


{% block extrahead %}
{% if request.locale == 'en-US' %}
<!-- Google Analytics Content Experiment code -->
<script>function utmx_section(){}function utmx(){}(function(){var
k='71153379-28',d=document,l=d.location,c=d.cookie;
if(l.search.indexOf('utm_expid='+k)>0)return;
function f(n){if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.
indexOf(';',i);return escape(c.substring(i+n.length+1,j<0?c.
length:j))}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;d.write(
'<sc'+'ript src="'+'http'+(l.protocol=='https:'?'s://ssl':
'://www')+'.google-analytics.com/ga_exp.js?'+'utmxkey='+k+
'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='+new Date().
valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
'" type="text/javascript" charset="utf-8"><\/sc'+'ript>')})();
</script><script>utmx('url','A/B');</script>
<!-- End of Google Analytics Content Experiment code -->
{% endif %}
{% endblock %}

{% block site_css %}
{{ css('firefox_new') }}
{% endblock %}
Expand Down
12 changes: 0 additions & 12 deletions bedrock/firefox/urls.py
Expand Up @@ -15,14 +15,6 @@
firstrun_re = latest_re % (version_re, 'firstrun')
whatsnew_re = latest_re % (version_re, 'whatsnew')

# firstrun testing
# allow any (or no) string for version number
# currently want to restrict to 21.0 only, but
# left here for possible future use
# remove when firstrun experiment is over
#latest_new_re = r'^firefox(?:/(%s))?/firstrun/(?P<view>[a|b])(?P<version>[1-6])/$'
#firstrun_new_re = latest_new_re % version_re


urlpatterns = patterns('',
url(r'^firefox/$', views.firefox_redirect, name='firefox'),
Expand Down Expand Up @@ -72,10 +64,6 @@
kwargs={'template_name': 'firefox/firstrun.html'}),
url(whatsnew_re, views.latest_fx_redirect, name='firefox.whatsnew',
kwargs={'template_name': 'firefox/whatsnew.html'}),
# firstrun tests (bug 865433 & 881207)
# remove when instructed by bug 877202
url('^firefox/22.0/firstrun/(?P<view>[a|b])/$', views.firstrun_new, name='firefox.firstrun.new'),

url(r'^firefox/partners/$', views.firefox_partners,
name='firefox.partners.index'),

Expand Down
64 changes: 27 additions & 37 deletions bedrock/firefox/views.py
Expand Up @@ -20,6 +20,7 @@

from bedrock.firefox import version_re
from bedrock.firefox.forms import SMSSendForm
from bedrock.mozorg.context_processors import funnelcake_param
from bedrock.mozorg.forms import WebToLeadForm
from bedrock.firefox.platforms import load_devices
from bedrock.firefox.utils import is_current_or_newer
Expand Down Expand Up @@ -55,6 +56,8 @@
#'nightly', # soon
]

FX_FIRSTRUN_FUNNELCAKE_CAMPAIGN = '25'


def get_js_bundle_files(bundle):
"""
Expand Down Expand Up @@ -206,19 +209,30 @@ def latest_fx_redirect(request, fake_version, template_name):
url = reverse('firefox.new') + query
return HttpResponsePermanentRedirect(url)

locales_with_video = {
'en-US': 'american',
'en-GB': 'british',
'de': 'german_final',
'it': 'italian_final',
'ja': 'japanese_final',
'es-AR': 'spanish_final',
'es-CL': 'spanish_final',
'es-ES': 'spanish_final',
'es-MX': 'spanish_final',
}
return l10n_utils.render(request, template_name,
{'locales_with_video': locales_with_video})
# display alternate firstrun content for en-US with proper funnelcake param in URL
# remove when firstrun test is complete
context = funnelcake_param(request)

if (template_name == 'firefox/firstrun.html'
and request.locale == 'en-US' and
context.get('funnelcake_id', 0) == FX_FIRSTRUN_FUNNELCAKE_CAMPAIGN):

return l10n_utils.render(request, 'firefox/firstrun/a.html')
else:
locales_with_video = {
'en-US': 'american',
'en-GB': 'british',
'de': 'german_final',
'it': 'italian_final',
'ja': 'japanese_final',
'es-AR': 'spanish_final',
'es-CL': 'spanish_final',
'es-ES': 'spanish_final',
'es-MX': 'spanish_final',
}

return l10n_utils.render(request, template_name,
{'locales_with_video': locales_with_video})


def all_downloads(request):
Expand Down Expand Up @@ -256,30 +270,6 @@ def firefox_partners(request):
return l10n_utils.render(request, 'firefox/partners/index.html', template_vars)


def firstrun_new(request, view):
# only Firefox users should see the firstrun pages
user_agent = request.META.get('HTTP_USER_AGENT', '')
if not 'Firefox' in user_agent:
url = reverse('firefox.new')
return HttpResponsePermanentRedirect(url)

# only users on the latest version should see the
# new pages (for GA experiment data purity)
user_version = "0"
ua_regexp = r"Firefox/(%s)" % version_re
match = re.search(ua_regexp, user_agent)
if match:
user_version = match.group(1)

if not is_current_or_newer(user_version):
url = reverse('firefox.update')
return HttpResponsePermanentRedirect(url)

template = view + '.html'

return l10n_utils.render(request, 'firefox/firstrun/' + template)


def releases_index(request):
releases = {}
major_releases = firefox_details.firefox_history_major_releases
Expand Down
4 changes: 0 additions & 4 deletions etc/httpd/global.conf
Expand Up @@ -264,10 +264,6 @@ RewriteRule ^/(\w{2,3}(?:-\w{2})?/)?mwc/?$ /$1firefox/partners/ [NC,L,R=301]
# bug 833645
RewriteRule ^/en-US/firefox(/(?:\d+\.\d+\.?(?:\d+)?\.?(?:\d+)?(?:[a|b]?)(?:\d*)(?:pre)?(?:\d)?))?/firstrun(/?)$ /b/en-US/firefox$1/firstrun$2 [PT]

# bug 865433 & 881207
# remove when prompted by bug 877202
RewriteRule ^/en-US/firefox(/(?:\d+\.\d+\.?(?:\d+)?\.?(?:\d+)?(?:[a|b]?)(?:\d*)(?:pre)?(?:\d)?))?/firstrun/([a|b])(/?)$ /b/en-US/firefox$1/firstrun/$2$3 [PT]

# bug 748503
RewriteRule ^/(\w{2,3}(?:-\w{2})?/)?projects/firefox/([^/]+)a[0-9]+/(firstrun|whatsnew)(.*)$ /$1firefox/nightly/firstrun$4 [L,R=301]
RewriteRule ^/(\w{2,3}(?:-\w{2})?/)?firefox/nightly/firstrun(.*)$ /b/$1firefox/nightly/firstrun$2 [PT]
Expand Down

0 comments on commit b257564

Please sign in to comment.