Commit 5903ef83 by Michael Frey

Merge pull request #11584 from edx/release

Merging release back to master
parents f4e462c7 da0992b4
...@@ -5,10 +5,21 @@ ...@@ -5,10 +5,21 @@
// We can't use JQuery's on load method because it // We can't use JQuery's on load method because it
// screws up RequireJS' JQuery initialization. // screws up RequireJS' JQuery initialization.
var onLoadCallback = function() { var onLoadCallback = function() {
analytics.identify("${user.id}", { analytics.identify(
email: "${user.email}", "${user.id}",
username: "${user.username}" {
}); email: "${user.email}",
username: "${user.username}"
},
{
integrations: {
// Disable MailChimp because we don't want to update the user's email
// and username in MailChimp on every page load. We only need to capture
// this data on registration/activation.
MailChimp: false
}
}
);
}; };
if (window.addEventListener) { if (window.addEventListener) {
window.addEventListener("load", onLoadCallback, false); window.addEventListener("load", onLoadCallback, false);
......
...@@ -136,6 +136,7 @@ class TestCreateAccount(TestCase): ...@@ -136,6 +136,7 @@ class TestCreateAccount(TestCase):
'username': self.params['username'], 'username': self.params['username'],
'name': self.params['name'], 'name': self.params['name'],
'age': 13, 'age': 13,
'yearOfBirth': year_of_birth,
'education': 'Associate degree', 'education': 'Associate degree',
'address': self.params['mailing_address'], 'address': self.params['mailing_address'],
'gender': 'Other/Prefer Not to Say', 'gender': 'Other/Prefer Not to Say',
......
...@@ -1242,10 +1242,19 @@ def login_user(request, error=""): # pylint: disable=too-many-statements,unused ...@@ -1242,10 +1242,19 @@ def login_user(request, error=""): # pylint: disable=too-many-statements,unused
# Track the user's sign in # Track the user's sign in
if hasattr(settings, 'LMS_SEGMENT_KEY') and settings.LMS_SEGMENT_KEY: if hasattr(settings, 'LMS_SEGMENT_KEY') and settings.LMS_SEGMENT_KEY:
tracking_context = tracker.get_tracker().resolve_context() tracking_context = tracker.get_tracker().resolve_context()
analytics.identify(user.id, { analytics.identify(
'email': email, user.id,
'username': username {
}) 'email': email,
'username': username
},
{
# Disable MailChimp because we don't want to update the user's email
# and username in MailChimp on every page load. We only need to capture
# this data on registration/activation.
'MailChimp': False
}
)
analytics.track( analytics.track(
user.id, user.id,
...@@ -1700,7 +1709,9 @@ def create_account_with_params(request, params): ...@@ -1700,7 +1709,9 @@ def create_account_with_params(request, params):
'email': user.email, 'email': user.email,
'username': user.username, 'username': user.username,
'name': profile.name, 'name': profile.name,
'age': profile.age, # Mailchimp requires the age & yearOfBirth to be integers, we send a sane integer default if falsey.
'age': profile.age or -1,
'yearOfBirth': profile.year_of_birth or datetime.datetime.now(UTC).year,
'education': profile.level_of_education_display, 'education': profile.level_of_education_display,
'address': profile.mailing_address, 'address': profile.mailing_address,
'gender': profile.gender_display, 'gender': profile.gender_display,
......
...@@ -3,10 +3,21 @@ ...@@ -3,10 +3,21 @@
<script type="text/javascript"> <script type="text/javascript">
% if user.is_authenticated(): % if user.is_authenticated():
$(window).load(function() { $(window).load(function() {
analytics.identify("${user.id}", { analytics.identify(
email: "${user.email}", "${user.id}",
username: "${user.username}" {
}); email: "${user.email}",
username: "${user.username}"
},
{
integrations: {
// Disable MailChimp because we don't want to update the user's email
// and username in MailChimp on every page load. We only need to capture
// this data on registration/activation.
MailChimp: false
}
}
);
}); });
% endif % endif
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment