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
46c73272
Unverified
Commit
46c73272
authored
Nov 15, 2017
by
Gabe Mulley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make image_url a function instead of a property
parent
52c33107
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
17 deletions
+16
-17
openedx/core/djangoapps/schedules/templatetags/ace.py
+1
-1
openedx/core/djangoapps/schedules/tests/test_tracking.py
+14
-14
openedx/core/djangoapps/schedules/tracking.py
+1
-2
No files found.
openedx/core/djangoapps/schedules/templatetags/ace.py
View file @
46c73272
...
...
@@ -112,7 +112,7 @@ def _get_google_analytics_tracking_url(context):
if
course_ids
is
not
None
and
len
(
course_ids
)
>
0
:
pixel
.
course_id
=
course_ids
[
0
]
return
pixel
.
image_url
return
pixel
.
generate_image_url
()
def
modify_url_to_track_clicks
(
url
,
campaign
=
None
):
...
...
openedx/core/djangoapps/schedules/tests/test_tracking.py
View file @
46c73272
...
...
@@ -72,9 +72,9 @@ class TestGoogleAnalyticsTrackingPixel(QueryStringAssertionMixin, CacheIsolation
@override_settings
(
GOOGLE_ANALYTICS_TRACKING_ID
=
'UA-123456-1'
)
def
test_default_parameters
(
self
):
pixel
=
GoogleAnalyticsTrackingPixel
()
self
.
assertIsNotNone
(
pixel
.
image_url
)
self
.
assertIsNotNone
(
pixel
.
generate_image_url
()
)
self
.
assert_url_components_equal
(
pixel
.
image_url
,
pixel
.
generate_image_url
()
,
scheme
=
'https'
,
netloc
=
'www.google-analytics.com'
,
path
=
'/collect'
,
...
...
@@ -100,9 +100,9 @@ class TestGoogleAnalyticsTrackingPixel(QueryStringAssertionMixin, CacheIsolation
document_path
=
'test_dp'
,
client_id
=
'123456.123456'
,
)
self
.
assertIsNotNone
(
pixel
.
image_url
)
self
.
assertIsNotNone
(
pixel
.
generate_image_url
()
)
self
.
assert_url_components_equal
(
pixel
.
image_url
,
pixel
.
generate_image_url
()
,
scheme
=
'https'
,
netloc
=
'www.google-analytics.com'
,
path
=
'/collect'
,
...
...
@@ -112,7 +112,7 @@ class TestGoogleAnalyticsTrackingPixel(QueryStringAssertionMixin, CacheIsolation
def
test_missing_settings
(
self
):
pixel
=
GoogleAnalyticsTrackingPixel
()
self
.
assertIsNone
(
pixel
.
image_url
)
self
.
assertIsNone
(
pixel
.
generate_image_url
()
)
@override_settings
(
GOOGLE_ANALYTICS_TRACKING_ID
=
'UA-123456-1'
)
def
test_site_config_override
(
self
):
...
...
@@ -122,7 +122,7 @@ class TestGoogleAnalyticsTrackingPixel(QueryStringAssertionMixin, CacheIsolation
)
)
pixel
=
GoogleAnalyticsTrackingPixel
(
site
=
site_config
.
site
)
self
.
assert_query_string_parameters_equal
(
pixel
.
image_url
,
tid
=
'UA-654321-1'
)
self
.
assert_query_string_parameters_equal
(
pixel
.
generate_image_url
()
,
tid
=
'UA-654321-1'
)
@override_settings
(
GOOGLE_ANALYTICS_TRACKING_ID
=
'UA-123456-1'
,
...
...
@@ -130,9 +130,9 @@ class TestGoogleAnalyticsTrackingPixel(QueryStringAssertionMixin, CacheIsolation
)
def
test_custom_dimension
(
self
):
pixel
=
GoogleAnalyticsTrackingPixel
(
user_id
=
10
,
campaign_source
=
None
,
campaign_medium
=
None
)
self
.
assertIsNotNone
(
pixel
.
image_url
)
self
.
assertIsNotNone
(
pixel
.
generate_image_url
()
)
self
.
assert_url_components_equal
(
pixel
.
image_url
,
pixel
.
generate_image_url
()
,
query
=
'v=1&t=event&ec=email&ea=edx.bi.email.opened&cid={cid}&tid=UA-123456-1&cd40=10&uid=10'
.
format
(
cid
=
GoogleAnalyticsTrackingPixel
.
ANONYMOUS_USER_CLIENT_ID
,
)
...
...
@@ -144,9 +144,9 @@ class TestGoogleAnalyticsTrackingPixel(QueryStringAssertionMixin, CacheIsolation
)
def
test_custom_dimension_without_user_id
(
self
):
pixel
=
GoogleAnalyticsTrackingPixel
(
campaign_source
=
None
,
campaign_medium
=
None
)
self
.
assertIsNotNone
(
pixel
.
image_url
)
self
.
assertIsNotNone
(
pixel
.
generate_image_url
()
)
self
.
assert_url_components_equal
(
pixel
.
image_url
,
pixel
.
generate_image_url
()
,
query
=
'v=1&t=event&ec=email&ea=edx.bi.email.opened&cid={cid}&tid=UA-123456-1'
.
format
(
cid
=
GoogleAnalyticsTrackingPixel
.
ANONYMOUS_USER_CLIENT_ID
,
)
...
...
@@ -156,11 +156,11 @@ class TestGoogleAnalyticsTrackingPixel(QueryStringAssertionMixin, CacheIsolation
def
test_course_id
(
self
):
course_id
=
'foo/bar/baz'
pixel
=
GoogleAnalyticsTrackingPixel
(
course_id
=
course_id
)
self
.
assertIsNotNone
(
pixel
.
image_url
)
self
.
assert_query_string_parameters_equal
(
pixel
.
image_url
,
el
=
course_id
)
self
.
assertIsNotNone
(
pixel
.
generate_image_url
()
)
self
.
assert_query_string_parameters_equal
(
pixel
.
generate_image_url
()
,
el
=
course_id
)
@override_settings
(
GOOGLE_ANALYTICS_TRACKING_ID
=
'UA-123456-1'
)
def
test_course_id_with_event_label
(
self
):
pixel
=
GoogleAnalyticsTrackingPixel
(
course_id
=
'foo/bar/baz'
,
event_label
=
'test_label'
)
self
.
assertIsNotNone
(
pixel
.
image_url
)
self
.
assert_query_string_parameters_equal
(
pixel
.
image_url
,
el
=
'test_label'
)
self
.
assertIsNotNone
(
pixel
.
generate_image_url
()
)
self
.
assert_query_string_parameters_equal
(
pixel
.
generate_image_url
()
,
el
=
'test_label'
)
openedx/core/djangoapps/schedules/tracking.py
View file @
46c73272
...
...
@@ -73,8 +73,7 @@ class GoogleAnalyticsTrackingPixel(object):
user_id
=
attr
.
ib
(
default
=
None
,
metadata
=
{
'param_name'
:
'uid'
})
client_id
=
attr
.
ib
(
default
=
ANONYMOUS_USER_CLIENT_ID
,
metadata
=
{
'param_name'
:
'cid'
})
@property
def
image_url
(
self
):
def
generate_image_url
(
self
):
"""
A URL to a clear image that can be embedded in HTML documents to track email open events.
...
...
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