Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
059d0dff
Commit
059d0dff
authored
Sep 10, 2014
by
Julia Hansbrough
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Login analytics
parent
9f8e2cf5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
5 deletions
+54
-5
common/djangoapps/student/views.py
+14
-5
common/djangoapps/third_party_auth/pipeline.py
+39
-0
common/djangoapps/third_party_auth/settings.py
+1
-0
No files found.
common/djangoapps/student/views.py
View file @
059d0dff
...
...
@@ -1005,7 +1005,8 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un
"edx.bi.user.account.authenticated"
,
{
'category'
:
"conversion"
,
'label'
:
registration_course_id
'label'
:
registration_course_id
,
'provider'
:
None
},
context
=
{
'Google Analytics'
:
{
...
...
@@ -1469,17 +1470,25 @@ def create_account(request, post_override=None): # pylint: disable-msg=too-many
if
settings
.
FEATURES
.
get
(
'SEGMENT_IO_LMS'
)
and
hasattr
(
settings
,
'SEGMENT_IO_LMS_KEY'
):
tracking_context
=
tracker
.
get_tracker
()
.
resolve_context
()
analytics
.
identify
(
user
.
id
,
{
email
:
email
,
username
:
username
,
'email'
:
email
,
'username'
:
username
,
})
# If the user is registering via 3rd party auth, track which provider they use
provider_name
=
None
if
settings
.
FEATURES
.
get
(
'ENABLE_THIRD_PARTY_AUTH'
)
and
pipeline
.
running
(
request
):
running_pipeline
=
pipeline
.
get
(
request
)
current_provider
=
provider
.
Registry
.
get_by_backend_name
(
running_pipeline
.
get
(
'backend'
))
provider_name
=
current_provider
.
NAME
registration_course_id
=
request
.
session
.
get
(
'registration_course_id'
)
analytics
.
track
(
user
.
id
,
"edx.bi.user.account.registered"
,
{
"category"
:
"conversion"
,
"label"
:
registration_course_id
'category'
:
'conversion'
,
'label'
:
registration_course_id
,
'provider'
:
provider_name
},
context
=
{
'Google Analytics'
:
{
...
...
common/djangoapps/third_party_auth/pipeline.py
View file @
059d0dff
...
...
@@ -59,6 +59,8 @@ See http://psa.matiasaguirre.net/docs/pipeline.html for more docs.
import
random
import
string
# pylint: disable-msg=deprecated-module
import
analytics
from
eventtracking
import
tracker
from
django.contrib.auth.models
import
User
from
django.core.urlresolvers
import
reverse
...
...
@@ -322,6 +324,10 @@ def parse_query_params(strategy, response, *args, **kwargs):
if
not
(
auth_entry
and
auth_entry
in
_AUTH_ENTRY_CHOICES
):
raise
AuthEntryError
(
strategy
.
backend
,
'auth_entry missing or invalid'
)
# Note: We expect only one member of this dictionary to be `True` at any
# given time. If something changes this convention in the future, please look
# at the `login_analytics` function in this file as well to ensure logging
# is still done properly
return
{
# Whether the auth pipeline entered from /dashboard.
'is_dashboard'
:
auth_entry
==
AUTH_ENTRY_DASHBOARD
,
...
...
@@ -360,3 +366,36 @@ def redirect_to_supplementary_form(strategy, details, response, uid, is_dashboar
if
is_register
and
user_unset
:
return
redirect
(
'/register'
,
name
=
'register_user'
)
@partial.partial
def
login_analytics
(
*
args
,
**
kwargs
):
event_name
=
None
action_to_event_name
=
{
'is_login'
:
'edx.bi.user.account.authenticated'
,
'is_dashboard'
:
'edx.bi.user.account.linked'
}
# Note: we assume only one of the `action` kwargs (is_dashboard, is_login) to be
# `True` at any given time
for
action
in
action_to_event_name
.
keys
():
if
kwargs
.
get
(
action
):
event_name
=
action_to_event_name
[
action
]
if
event_name
is
not
None
:
registration_course_id
=
kwargs
[
'request'
]
.
session
.
get
(
'registration_course_id'
)
tracking_context
=
tracker
.
get_tracker
()
.
resolve_context
()
analytics
.
track
(
kwargs
[
'user'
]
.
id
,
event_name
,
{
'category'
:
"conversion"
,
'label'
:
registration_course_id
,
'provider'
:
getattr
(
kwargs
[
'backend'
],
'name'
)
},
context
=
{
'Google Analytics'
:
{
'clientId'
:
tracking_context
.
get
(
'client_id'
)
}
}
)
common/djangoapps/third_party_auth/settings.py
View file @
059d0dff
...
...
@@ -109,6 +109,7 @@ def _set_global_settings(django_settings):
'social.pipeline.social_auth.associate_user'
,
'social.pipeline.social_auth.load_extra_data'
,
'social.pipeline.user.user_details'
,
'third_party_auth.pipeline.login_analytics'
,
)
# We let the user specify their email address during signup.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment