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
ca6633bd
Commit
ca6633bd
authored
Sep 30, 2015
by
Bill DeRusha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add IP to all python Segment tracking calls
parent
e0c430ff
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
20 additions
and
4 deletions
+20
-4
common/djangoapps/student/models.py
+1
-0
common/djangoapps/student/views.py
+2
-0
common/djangoapps/third_party_auth/pipeline.py
+1
-0
lms/djangoapps/commerce/__init__.py
+4
-1
lms/djangoapps/commerce/tests/__init__.py
+2
-1
lms/djangoapps/courseware/tests/test_views.py
+1
-0
lms/djangoapps/courseware/views.py
+1
-0
lms/djangoapps/shoppingcart/models.py
+1
-0
lms/djangoapps/shoppingcart/tests/test_models.py
+2
-2
lms/djangoapps/verify_student/tests/test_views.py
+2
-0
lms/djangoapps/verify_student/views.py
+2
-0
openedx/core/djangoapps/user_api/preferences/api.py
+1
-0
No files found.
common/djangoapps/student/models.py
View file @
ca6633bd
...
@@ -1062,6 +1062,7 @@ class CourseEnrollment(models.Model):
...
@@ -1062,6 +1062,7 @@ class CourseEnrollment(models.Model):
'run'
:
self
.
course_id
.
run
,
'run'
:
self
.
course_id
.
run
,
'mode'
:
self
.
mode
,
'mode'
:
self
.
mode
,
},
context
=
{
},
context
=
{
'ip'
:
tracking_context
.
get
(
'ip'
),
'Google Analytics'
:
{
'Google Analytics'
:
{
'clientId'
:
tracking_context
.
get
(
'client_id'
)
'clientId'
:
tracking_context
.
get
(
'client_id'
)
}
}
...
...
common/djangoapps/student/views.py
View file @
ca6633bd
...
@@ -1179,6 +1179,7 @@ def login_user(request, error=""): # pylint: disable=too-many-statements,unused
...
@@ -1179,6 +1179,7 @@ def login_user(request, error=""): # pylint: disable=too-many-statements,unused
'provider'
:
None
'provider'
:
None
},
},
context
=
{
context
=
{
'ip'
:
tracking_context
.
get
(
'ip'
),
'Google Analytics'
:
{
'Google Analytics'
:
{
'clientId'
:
tracking_context
.
get
(
'client_id'
)
'clientId'
:
tracking_context
.
get
(
'client_id'
)
}
}
...
@@ -1635,6 +1636,7 @@ def create_account_with_params(request, params):
...
@@ -1635,6 +1636,7 @@ def create_account_with_params(request, params):
'provider'
:
third_party_provider
.
name
if
third_party_provider
else
None
'provider'
:
third_party_provider
.
name
if
third_party_provider
else
None
},
},
context
=
{
context
=
{
'ip'
:
tracking_context
.
get
(
'ip'
),
'Google Analytics'
:
{
'Google Analytics'
:
{
'clientId'
:
tracking_context
.
get
(
'client_id'
)
'clientId'
:
tracking_context
.
get
(
'client_id'
)
}
}
...
...
common/djangoapps/third_party_auth/pipeline.py
View file @
ca6633bd
...
@@ -604,6 +604,7 @@ def login_analytics(strategy, auth_entry, *args, **kwargs):
...
@@ -604,6 +604,7 @@ def login_analytics(strategy, auth_entry, *args, **kwargs):
'provider'
:
getattr
(
kwargs
[
'backend'
],
'name'
)
'provider'
:
getattr
(
kwargs
[
'backend'
],
'name'
)
},
},
context
=
{
context
=
{
'ip'
:
tracking_context
.
get
(
'ip'
),
'Google Analytics'
:
{
'Google Analytics'
:
{
'clientId'
:
tracking_context
.
get
(
'client_id'
)
'clientId'
:
tracking_context
.
get
(
'client_id'
)
}
}
...
...
lms/djangoapps/commerce/__init__.py
View file @
ca6633bd
...
@@ -7,9 +7,12 @@ from eventtracking import tracker
...
@@ -7,9 +7,12 @@ from eventtracking import tracker
def
create_tracking_context
(
user
):
def
create_tracking_context
(
user
):
""" Assembles attributes from user and request objects to be sent along
""" Assembles attributes from user and request objects to be sent along
in ecommerce api calls for tracking purposes. """
in ecommerce api calls for tracking purposes. """
context_tracker
=
tracker
.
get_tracker
()
.
resolve_context
()
return
{
return
{
'lms_user_id'
:
user
.
id
,
'lms_user_id'
:
user
.
id
,
'lms_client_id'
:
tracker
.
get_tracker
()
.
resolve_context
()
.
get
(
'client_id'
)
'lms_client_id'
:
context_tracker
.
get
(
'client_id'
),
'lms_ip'
:
context_tracker
.
get
(
'ip'
),
}
}
...
...
lms/djangoapps/commerce/tests/__init__.py
View file @
ca6633bd
...
@@ -60,7 +60,7 @@ class EcommerceApiClientTest(TestCase):
...
@@ -60,7 +60,7 @@ class EcommerceApiClientTest(TestCase):
)
)
mock_tracker
=
mock
.
Mock
()
mock_tracker
=
mock
.
Mock
()
mock_tracker
.
resolve_context
=
mock
.
Mock
(
return_value
=
{
'client_id'
:
self
.
TEST_CLIENT_ID
})
mock_tracker
.
resolve_context
=
mock
.
Mock
(
return_value
=
{
'client_id'
:
self
.
TEST_CLIENT_ID
,
'ip'
:
'127.0.0.1'
})
with
mock
.
patch
(
'commerce.tracker.get_tracker'
,
return_value
=
mock_tracker
):
with
mock
.
patch
(
'commerce.tracker.get_tracker'
,
return_value
=
mock_tracker
):
ecommerce_api_client
(
self
.
user
)
.
baskets
(
1
)
.
post
()
ecommerce_api_client
(
self
.
user
)
.
baskets
(
1
)
.
post
()
...
@@ -75,6 +75,7 @@ class EcommerceApiClientTest(TestCase):
...
@@ -75,6 +75,7 @@ class EcommerceApiClientTest(TestCase):
'tracking_context'
:
{
'tracking_context'
:
{
'lms_user_id'
:
self
.
user
.
id
,
# pylint: disable=no-member
'lms_user_id'
:
self
.
user
.
id
,
# pylint: disable=no-member
'lms_client_id'
:
self
.
TEST_CLIENT_ID
,
'lms_client_id'
:
self
.
TEST_CLIENT_ID
,
'lms_ip'
:
'127.0.0.1'
,
},
},
}
}
...
...
lms/djangoapps/courseware/tests/test_views.py
View file @
ca6633bd
...
@@ -944,6 +944,7 @@ class GenerateUserCertTests(ModuleStoreTestCase):
...
@@ -944,6 +944,7 @@ class GenerateUserCertTests(ModuleStoreTestCase):
},
},
context
=
{
context
=
{
'ip'
:
'127.0.0.1'
,
'Google Analytics'
:
'Google Analytics'
:
{
'clientId'
:
None
}
{
'clientId'
:
None
}
}
}
...
...
lms/djangoapps/courseware/views.py
View file @
ca6633bd
...
@@ -1395,6 +1395,7 @@ def _track_successful_certificate_generation(user_id, course_id): # pylint: dis
...
@@ -1395,6 +1395,7 @@ def _track_successful_certificate_generation(user_id, course_id): # pylint: dis
'label'
:
unicode
(
course_id
)
'label'
:
unicode
(
course_id
)
},
},
context
=
{
context
=
{
'ip'
:
tracking_context
.
get
(
'ip'
),
'Google Analytics'
:
{
'Google Analytics'
:
{
'clientId'
:
tracking_context
.
get
(
'client_id'
)
'clientId'
:
tracking_context
.
get
(
'client_id'
)
}
}
...
...
lms/djangoapps/shoppingcart/models.py
View file @
ca6633bd
...
@@ -517,6 +517,7 @@ class Order(models.Model):
...
@@ -517,6 +517,7 @@ class Order(models.Model):
'currency'
:
self
.
currency
,
'currency'
:
self
.
currency
,
'products'
:
[
item
.
analytics_data
()
for
item
in
orderitems
]
'products'
:
[
item
.
analytics_data
()
for
item
in
orderitems
]
},
context
=
{
},
context
=
{
'ip'
:
tracking_context
.
get
(
'ip'
),
'Google Analytics'
:
{
'Google Analytics'
:
{
'clientId'
:
tracking_context
.
get
(
'client_id'
)
'clientId'
:
tracking_context
.
get
(
'client_id'
)
}
}
...
...
lms/djangoapps/shoppingcart/tests/test_models.py
View file @
ca6633bd
...
@@ -265,7 +265,7 @@ class OrderTest(ModuleStoreTestCase):
...
@@ -265,7 +265,7 @@ class OrderTest(ModuleStoreTestCase):
}
}
]
]
},
},
context
=
{
'Google Analytics'
:
{
'clientId'
:
None
}}
context
=
{
'
ip'
:
None
,
'
Google Analytics'
:
{
'clientId'
:
None
}}
)
)
def
test_purchase_item_failure
(
self
):
def
test_purchase_item_failure
(
self
):
...
@@ -860,7 +860,7 @@ class CertificateItemTest(ModuleStoreTestCase):
...
@@ -860,7 +860,7 @@ class CertificateItemTest(ModuleStoreTestCase):
}
}
]
]
},
},
context
=
{
'Google Analytics'
:
{
'clientId'
:
None
}}
context
=
{
'
ip'
:
None
,
'
Google Analytics'
:
{
'clientId'
:
None
}}
)
)
def
test_existing_enrollment
(
self
):
def
test_existing_enrollment
(
self
):
...
...
lms/djangoapps/verify_student/tests/test_views.py
View file @
ca6633bd
...
@@ -1963,6 +1963,7 @@ class TestInCourseReverifyView(ModuleStoreTestCase):
...
@@ -1963,6 +1963,7 @@ class TestInCourseReverifyView(ModuleStoreTestCase):
},
},
context
=
{
context
=
{
'ip'
:
'127.0.0.1'
,
'Google Analytics'
:
'Google Analytics'
:
{
'clientId'
:
None
}
{
'clientId'
:
None
}
}
}
...
@@ -2020,6 +2021,7 @@ class TestInCourseReverifyView(ModuleStoreTestCase):
...
@@ -2020,6 +2021,7 @@ class TestInCourseReverifyView(ModuleStoreTestCase):
'checkpoint'
:
self
.
reverification_assessment
'checkpoint'
:
self
.
reverification_assessment
},
},
context
=
{
context
=
{
'ip'
:
'127.0.0.1'
,
'Google Analytics'
:
'Google Analytics'
:
{
'clientId'
:
None
}
{
'clientId'
:
None
}
}
}
...
...
lms/djangoapps/verify_student/views.py
View file @
ca6633bd
...
@@ -1105,6 +1105,7 @@ class SubmitPhotosView(View):
...
@@ -1105,6 +1105,7 @@ class SubmitPhotosView(View):
if
settings
.
SEGMENT_KEY
:
if
settings
.
SEGMENT_KEY
:
tracking_context
=
tracker
.
get_tracker
()
.
resolve_context
()
tracking_context
=
tracker
.
get_tracker
()
.
resolve_context
()
context
=
{
context
=
{
'ip'
:
tracking_context
.
get
(
'ip'
),
'Google Analytics'
:
{
'Google Analytics'
:
{
'clientId'
:
tracking_context
.
get
(
'client_id'
)
'clientId'
:
tracking_context
.
get
(
'client_id'
)
}
}
...
@@ -1450,6 +1451,7 @@ class InCourseReverifyView(View):
...
@@ -1450,6 +1451,7 @@ class InCourseReverifyView(View):
'checkpoint'
:
checkpoint
'checkpoint'
:
checkpoint
},
},
context
=
{
context
=
{
'ip'
:
tracking_context
.
get
(
'ip'
),
'Google Analytics'
:
{
'Google Analytics'
:
{
'clientId'
:
tracking_context
.
get
(
'client_id'
)
'clientId'
:
tracking_context
.
get
(
'client_id'
)
}
}
...
...
openedx/core/djangoapps/user_api/preferences/api.py
View file @
ca6633bd
...
@@ -290,6 +290,7 @@ def _track_update_email_opt_in(user_id, organization, opt_in):
...
@@ -290,6 +290,7 @@ def _track_update_email_opt_in(user_id, organization, opt_in):
'label'
:
organization
'label'
:
organization
},
},
context
=
{
context
=
{
'ip'
:
tracking_context
.
get
(
'ip'
),
'Google Analytics'
:
{
'Google Analytics'
:
{
'clientId'
:
tracking_context
.
get
(
'client_id'
)
'clientId'
:
tracking_context
.
get
(
'client_id'
)
}
}
...
...
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