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
bcb71a32
Commit
bcb71a32
authored
Oct 01, 2015
by
Bill DeRusha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename SEGMENT_KEY to have a unique key name for both CMS and LMS
parent
cc15a9ad
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
30 additions
and
30 deletions
+30
-30
cms/envs/aws.py
+1
-1
cms/envs/common.py
+1
-1
cms/envs/dev.py
+1
-1
cms/envs/test.py
+1
-1
cms/envs/yaml_config.py
+1
-1
cms/templates/widgets/segment-io.html
+2
-2
common/djangoapps/student/models.py
+1
-1
common/djangoapps/student/views.py
+2
-2
common/djangoapps/third_party_auth/pipeline.py
+1
-1
lms/djangoapps/courseware/tests/test_views.py
+2
-2
lms/djangoapps/courseware/views.py
+1
-1
lms/djangoapps/shoppingcart/models.py
+1
-1
lms/djangoapps/shoppingcart/tests/test_models.py
+3
-3
lms/djangoapps/verify_student/tests/test_views.py
+2
-2
lms/djangoapps/verify_student/views.py
+2
-2
lms/envs/aws.py
+1
-1
lms/envs/common.py
+1
-1
lms/envs/dev.py
+1
-1
lms/startup.py
+2
-2
lms/templates/widgets/segment-io.html
+2
-2
openedx/core/djangoapps/user_api/preferences/api.py
+1
-1
No files found.
cms/envs/aws.py
View file @
bcb71a32
...
...
@@ -244,7 +244,7 @@ EMAIL_HOST_USER = AUTH_TOKENS.get('EMAIL_HOST_USER', EMAIL_HOST_USER)
EMAIL_HOST_PASSWORD
=
AUTH_TOKENS
.
get
(
'EMAIL_HOST_PASSWORD'
,
EMAIL_HOST_PASSWORD
)
# Note that this is the Studio key for Segment. There is a separate key for the LMS.
SEGMENT_KEY
=
AUTH_TOKENS
.
get
(
'SEGMENT_KEY'
)
CMS_
SEGMENT_KEY
=
AUTH_TOKENS
.
get
(
'SEGMENT_KEY'
)
AWS_ACCESS_KEY_ID
=
AUTH_TOKENS
[
"AWS_ACCESS_KEY_ID"
]
if
AWS_ACCESS_KEY_ID
==
""
:
...
...
cms/envs/common.py
View file @
bcb71a32
...
...
@@ -78,7 +78,7 @@ FEATURES = {
'STUDIO_REQUEST_EMAIL'
:
''
,
# Segment - must explicitly turn it on for production
'SEGMENT_KEY'
:
None
,
'
CMS_
SEGMENT_KEY'
:
None
,
# Enable URL that shows information about the status of various services
'ENABLE_SERVICE_STATUS'
:
False
,
...
...
cms/envs/dev.py
View file @
bcb71a32
...
...
@@ -167,7 +167,7 @@ FEATURES['ENABLE_SERVICE_STATUS'] = True
# If there's an environment variable set, grab it to turn on Segment
# Note that this is the Studio key. There is a separate key for the LMS.
import
os
SEGMENT_KEY
=
os
.
environ
.
get
(
'SEGMENT_KEY'
)
CMS_
SEGMENT_KEY
=
os
.
environ
.
get
(
'SEGMENT_KEY'
)
#####################################################################
...
...
cms/envs/test.py
View file @
bcb71a32
...
...
@@ -211,7 +211,7 @@ PASSWORD_HASHERS = (
)
# No segment key
SEGMENT_KEY
=
None
CMS_
SEGMENT_KEY
=
None
FEATURES
[
'ENABLE_SERVICE_STATUS'
]
=
True
...
...
cms/envs/yaml_config.py
View file @
bcb71a32
...
...
@@ -120,7 +120,7 @@ ADDL_INSTALLED_APPS = []
AUTH_USE_CAS
=
False
CAS_ATTRIBUTE_CALLBACK
=
None
MICROSITE_ROOT_DIR
=
''
SEGMENT_KEY
=
None
CMS_
SEGMENT_KEY
=
None
DATADOG
=
{}
ADDL_INSTALLED_APPS
=
[]
LOCAL_LOGLEVEL
=
'INFO'
...
...
cms/templates/widgets/segment-io.html
View file @
bcb71a32
...
...
@@ -6,7 +6,7 @@
%
>
% endif
% if settings.SEGMENT_KEY:
% if settings.
CMS_
SEGMENT_KEY:
<!-- begin Segment -->
<script
type=
"text/javascript"
>
// if inside course, inject the course location into the JS namespace
...
...
@@ -15,7 +15,7 @@
%
endif
var
analytics
=
analytics
||
[];
analytics
.
load
=
function
(
e
){
var
t
=
document
.
createElement
(
"script"
);
t
.
type
=
"text/javascript"
,
t
.
async
=!
0
,
t
.
src
=
(
"https:"
===
document
.
location
.
protocol
?
"https://"
:
"http://"
)
+
"d2dq2ahtl5zl1z.cloudfront.net/analytics.js/v1/"
+
e
+
"/analytics.min.js"
;
var
n
=
document
.
getElementsByTagName
(
"script"
)[
0
];
n
.
parentNode
.
insertBefore
(
t
,
n
);
var
r
=
function
(
e
){
return
function
(){
analytics
.
push
([
e
].
concat
(
Array
.
prototype
.
slice
.
call
(
arguments
,
0
)))}},
i
=
[
"identify"
,
"track"
,
"trackLink"
,
"trackForm"
,
"trackClick"
,
"trackSubmit"
,
"pageview"
,
"ab"
,
"alias"
,
"ready"
];
for
(
var
s
=
0
;
s
<
i
.
length
;
s
++
)
analytics
[
i
[
s
]]
=
r
(
i
[
s
])};
analytics
.
load
(
"${ settings.SEGMENT_KEY }"
);
analytics
.
load
(
"${ settings.
CMS_
SEGMENT_KEY }"
);
%
if
user
.
is_authenticated
():
analytics
.
identify
(
"${ user.id }"
,
{
...
...
common/djangoapps/student/models.py
View file @
bcb71a32
...
...
@@ -1052,7 +1052,7 @@ class CourseEnrollment(models.Model):
with
tracker
.
get_tracker
()
.
context
(
event_name
,
context
):
tracker
.
emit
(
event_name
,
data
)
if
settings
.
SEGMENT_KEY
:
if
hasattr
(
settings
,
'LMS_SEGMENT_KEY'
)
and
settings
.
LMS_
SEGMENT_KEY
:
tracking_context
=
tracker
.
get_tracker
()
.
resolve_context
()
analytics
.
track
(
self
.
user_id
,
event_name
,
{
'category'
:
'conversion'
,
...
...
common/djangoapps/student/views.py
View file @
bcb71a32
...
...
@@ -1163,7 +1163,7 @@ def login_user(request, error=""): # pylint: disable=too-many-statements,unused
LoginFailures
.
clear_lockout_counter
(
user
)
# Track the user's sign in
if
settings
.
SEGMENT_KEY
:
if
hasattr
(
settings
,
'LMS_SEGMENT_KEY'
)
and
settings
.
LMS_
SEGMENT_KEY
:
tracking_context
=
tracker
.
get_tracker
()
.
resolve_context
()
analytics
.
identify
(
user
.
id
,
{
'email'
:
email
,
...
...
@@ -1601,7 +1601,7 @@ def create_account_with_params(request, params):
third_party_provider
=
provider
.
Registry
.
get_from_pipeline
(
running_pipeline
)
# Track the user's registration
if
settings
.
SEGMENT_KEY
:
if
hasattr
(
settings
,
'LMS_SEGMENT_KEY'
)
and
settings
.
LMS_
SEGMENT_KEY
:
tracking_context
=
tracker
.
get_tracker
()
.
resolve_context
()
identity_args
=
[
user
.
id
,
# pylint: disable=no-member
...
...
common/djangoapps/third_party_auth/pipeline.py
View file @
bcb71a32
...
...
@@ -593,7 +593,7 @@ def login_analytics(strategy, auth_entry, *args, **kwargs):
elif
auth_entry
in
[
AUTH_ENTRY_ACCOUNT_SETTINGS
]:
event_name
=
'edx.bi.user.account.linked'
if
event_name
is
not
None
and
settings
.
SEGMENT_KEY
:
if
event_name
is
not
None
and
hasattr
(
settings
,
'LMS_SEGMENT_KEY'
)
and
settings
.
LMS_
SEGMENT_KEY
:
tracking_context
=
tracker
.
get_tracker
()
.
resolve_context
()
analytics
.
track
(
kwargs
[
'user'
]
.
id
,
...
...
lms/djangoapps/courseware/tests/test_views.py
View file @
bcb71a32
...
...
@@ -919,7 +919,7 @@ class GenerateUserCertTests(ModuleStoreTestCase):
self
.
assertIn
(
"Your certificate will be available when you pass the course."
,
resp
.
content
)
@patch
(
'courseware.grades.grade'
,
Mock
(
return_value
=
{
'grade'
:
'Pass'
,
'percent'
:
0.75
}))
@override_settings
(
CERT_QUEUE
=
'certificates'
,
SEGMENT_KEY
=
"foobar"
)
@override_settings
(
CERT_QUEUE
=
'certificates'
,
LMS_
SEGMENT_KEY
=
"foobar"
)
def
test_user_with_passing_grade
(
self
):
# If user has above passing grading then json will return cert generating message and
# status valid code
...
...
@@ -965,7 +965,7 @@ class GenerateUserCertTests(ModuleStoreTestCase):
self
.
assertIn
(
"Certificate is being created."
,
resp
.
content
)
@patch
(
'courseware.grades.grade'
,
Mock
(
return_value
=
{
'grade'
:
'Pass'
,
'percent'
:
0.75
}))
@override_settings
(
CERT_QUEUE
=
'certificates'
,
SEGMENT_KEY
=
"foobar"
)
@override_settings
(
CERT_QUEUE
=
'certificates'
,
LMS_
SEGMENT_KEY
=
"foobar"
)
def
test_user_with_passing_existing_downloadable_cert
(
self
):
# If user has already downloadable certificate
# then json will return cert generating message with bad request code
...
...
lms/djangoapps/courseware/views.py
View file @
bcb71a32
...
...
@@ -1383,7 +1383,7 @@ def _track_successful_certificate_generation(user_id, course_id): # pylint: dis
None
"""
if
settings
.
SEGMENT_KEY
:
if
settings
.
LMS_
SEGMENT_KEY
:
event_name
=
'edx.bi.user.certificate.generate'
tracking_context
=
tracker
.
get_tracker
()
.
resolve_context
()
...
...
lms/djangoapps/shoppingcart/models.py
View file @
bcb71a32
...
...
@@ -509,7 +509,7 @@ class Order(models.Model):
"""
try
:
if
settings
.
SEGMENT_KEY
:
if
settings
.
LMS_
SEGMENT_KEY
:
tracking_context
=
tracker
.
get_tracker
()
.
resolve_context
()
analytics
.
track
(
self
.
user
.
id
,
event_name
,
{
# pylint: disable=no-member
'orderId'
:
self
.
id
,
# pylint: disable=no-member
...
...
lms/djangoapps/shoppingcart/tests/test_models.py
View file @
bcb71a32
...
...
@@ -220,7 +220,7 @@ class OrderTest(ModuleStoreTestCase):
self
.
assertEqual
(
item
.
status
,
status
)
@override_settings
(
SEGMENT_KEY
=
"foobar"
,
LMS_
SEGMENT_KEY
=
"foobar"
,
FEATURES
=
{
'STORE_BILLING_INFO'
:
True
,
}
...
...
@@ -883,7 +883,7 @@ class CertificateItemTest(ModuleStoreTestCase):
self
.
assertEquals
(
cert_item
.
single_item_receipt_template
,
'shoppingcart/receipt.html'
)
@override_settings
(
SEGMENT_KEY
=
"foobar"
,
LMS_
SEGMENT_KEY
=
"foobar"
,
FEATURES
=
{
'STORE_BILLING_INFO'
:
True
,
}
...
...
@@ -924,7 +924,7 @@ class CertificateItemTest(ModuleStoreTestCase):
self
.
assertEquals
(
target_certs
[
0
]
.
order
.
status
,
'purchased'
)
@override_settings
(
SEGMENT_KEY
=
"foobar"
,
LMS_
SEGMENT_KEY
=
"foobar"
,
FEATURES
=
{
'STORE_BILLING_INFO'
:
True
,
}
...
...
lms/djangoapps/verify_student/tests/test_views.py
View file @
bcb71a32
...
...
@@ -1939,7 +1939,7 @@ class TestInCourseReverifyView(ModuleStoreTestCase):
url
+=
u"?{params}"
.
format
(
params
=
urllib
.
urlencode
({
"checkpoint"
:
self
.
reverification_location
}))
self
.
assertRedirects
(
response
,
url
)
@override_settings
(
SEGMENT_KEY
=
"foobar"
)
@override_settings
(
LMS_
SEGMENT_KEY
=
"foobar"
)
@patch.dict
(
settings
.
FEATURES
,
{
'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'
:
True
})
def
test_incourse_reverify_get
(
self
):
"""
...
...
@@ -1994,7 +1994,7 @@ class TestInCourseReverifyView(ModuleStoreTestCase):
response
=
self
.
_submit_photos
(
self
.
course_key
,
self
.
reverification_location
,
""
)
self
.
assertEqual
(
response
.
status_code
,
400
)
@override_settings
(
SEGMENT_KEY
=
"foobar"
)
@override_settings
(
LMS_
SEGMENT_KEY
=
"foobar"
)
@patch.dict
(
settings
.
FEATURES
,
{
'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'
:
True
})
def
test_incourse_reverify_post
(
self
):
self
.
_create_checkpoint
()
...
...
lms/djangoapps/verify_student/views.py
View file @
bcb71a32
...
...
@@ -1102,7 +1102,7 @@ class SubmitPhotosView(View):
Returns: None
"""
if
settings
.
SEGMENT_KEY
:
if
settings
.
LMS_
SEGMENT_KEY
:
tracking_context
=
tracker
.
get_tracker
()
.
resolve_context
()
context
=
{
'Google Analytics'
:
{
...
...
@@ -1439,7 +1439,7 @@ class InCourseReverifyView(View):
event_name
,
user_id
,
course_id
,
checkpoint
)
if
settings
.
SEGMENT_KEY
:
if
settings
.
LMS_
SEGMENT_KEY
:
tracking_context
=
tracker
.
get_tracker
()
.
resolve_context
()
analytics
.
track
(
user_id
,
...
...
lms/envs/aws.py
View file @
bcb71a32
...
...
@@ -400,7 +400,7 @@ if 'DJFS' in AUTH_TOKENS and AUTH_TOKENS['DJFS'] is not None:
HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS
=
ENV_TOKENS
.
get
(
'HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS'
,
{})
############### Mixed Related(Secure/Not-Secure) Items ##########
SEGMENT_KEY
=
AUTH_TOKENS
.
get
(
'SEGMENT_KEY'
)
LMS_
SEGMENT_KEY
=
AUTH_TOKENS
.
get
(
'SEGMENT_KEY'
)
CC_PROCESSOR_NAME
=
AUTH_TOKENS
.
get
(
'CC_PROCESSOR_NAME'
,
CC_PROCESSOR_NAME
)
CC_PROCESSOR
=
AUTH_TOKENS
.
get
(
'CC_PROCESSOR'
,
CC_PROCESSOR
)
...
...
lms/envs/common.py
View file @
bcb71a32
...
...
@@ -608,7 +608,7 @@ USAGE_ID_PATTERN = r'(?P<usage_id>(?:i4x://?[^/]+/[^/]+/[^/]+/[^@]+(?:@[^/]+)?)|
############################## EVENT TRACKING #################################
SEGMENT_KEY
=
None
LMS_
SEGMENT_KEY
=
None
# FIXME: Should we be doing this truncation?
TRACK_MAX_EVENT
=
50000
...
...
lms/envs/dev.py
View file @
bcb71a32
...
...
@@ -275,7 +275,7 @@ ANALYTICS_API_KEY = ""
##### Segment ######
# If there's an environment variable set, grab it
SEGMENT_KEY
=
os
.
environ
.
get
(
'SEGMENT_KEY'
)
LMS_
SEGMENT_KEY
=
os
.
environ
.
get
(
'SEGMENT_KEY'
)
###################### Payment ######################
...
...
lms/startup.py
View file @
bcb71a32
...
...
@@ -39,8 +39,8 @@ def run():
enable_third_party_auth
()
# Initialize Segment analytics module by setting the write_key.
if
settings
.
SEGMENT_KEY
:
analytics
.
write_key
=
settings
.
SEGMENT_KEY
if
settings
.
LMS_
SEGMENT_KEY
:
analytics
.
write_key
=
settings
.
LMS_
SEGMENT_KEY
# register any dependency injections that we need to support in edx_proctoring
# right now edx_proctoring is dependent on the openedx.core.djangoapps.credit
...
...
lms/templates/widgets/segment-io.html
View file @
bcb71a32
% if settings.SEGMENT_KEY:
% if settings.
LMS_
SEGMENT_KEY:
<!-- begin Segment -->
<script
type=
"text/javascript"
>
// Asynchronously load Segment's analytics.js library
window
.
analytics
||
(
window
.
analytics
=
[]),
window
.
analytics
.
methods
=
[
"identify"
,
"track"
,
"trackLink"
,
"trackForm"
,
"trackClick"
,
"trackSubmit"
,
"page"
,
"pageview"
,
"ab"
,
"alias"
,
"ready"
,
"group"
,
"on"
,
"once"
,
"off"
],
window
.
analytics
.
factory
=
function
(
t
){
return
function
(){
var
a
=
Array
.
prototype
.
slice
.
call
(
arguments
);
return
a
.
unshift
(
t
),
window
.
analytics
.
push
(
a
),
window
.
analytics
}};
for
(
var
i
=
0
;
i
<
window
.
analytics
.
methods
.
length
;
i
++
){
var
method
=
window
.
analytics
.
methods
[
i
];
window
.
analytics
[
method
]
=
window
.
analytics
.
factory
(
method
)}
window
.
analytics
.
load
=
function
(
t
){
var
a
=
document
.
createElement
(
"script"
);
a
.
type
=
"text/javascript"
,
a
.
async
=!
0
,
a
.
src
=
(
"https:"
===
document
.
location
.
protocol
?
"https://"
:
"http://"
)
+
"d2dq2ahtl5zl1z.cloudfront.net/analytics.js/v1/"
+
t
+
"/analytics.min.js"
;
var
n
=
document
.
getElementsByTagName
(
"script"
)[
0
];
n
.
parentNode
.
insertBefore
(
a
,
n
)},
window
.
analytics
.
SNIPPET_VERSION
=
"2.0.8"
,
analytics
.
load
(
"${ settings.SEGMENT_KEY }"
);
analytics
.
load
(
"${ settings.
LMS_
SEGMENT_KEY }"
);
analytics
.
page
();
%
if
user
.
is_authenticated
():
...
...
openedx/core/djangoapps/user_api/preferences/api.py
View file @
bcb71a32
...
...
@@ -261,7 +261,7 @@ def update_email_opt_in(user, org, opt_in):
preference
.
value
=
str
(
opt_in
)
try
:
preference
.
save
()
if
settings
.
SEGMENT_KEY
:
if
hasattr
(
settings
,
'LMS_SEGMENT_KEY'
)
and
settings
.
LMS_
SEGMENT_KEY
:
_track_update_email_opt_in
(
user
.
id
,
org
,
opt_in
)
except
IntegrityError
as
err
:
log
.
warn
(
u"Could not update organization wide preference due to IntegrityError: {}"
.
format
(
err
.
message
))
...
...
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