Skip to content

Commit

Permalink
fix: Properly use NOTICES_SEGMENT_KEY from context (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tj-Tracy authored Nov 2, 2021
1 parent e5811b4 commit 24ce106
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Change Log
Unreleased
~~~~~~~~~~

[0.11.1] - 2021-10-29
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* fix analytics key in template

[0.11.0] - 2021-11-1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Add in a setting to limit the number of days you can snooze a notice.
Expand Down
2 changes: 1 addition & 1 deletion notices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
An edx-platform plugin which manages notices that must be acknowledged.
"""

__version__ = "0.11.0"
__version__ = "0.11.1"

default_app_config = "notices.apps.NoticesConfig" # pylint: disable=invalid-name
33 changes: 16 additions & 17 deletions notices/templates/notice.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,26 @@
</script>
<script src="{% static 'notices/js/utils.js' %}"></script>
{{ head_content|safe }}
{% if settings.NOTICES_SEGMENT_KEY %}
{% if NOTICES_SEGMENT_KEY %}
<!-- begin Segment -->
<script type="text/javascript">
// Asynchronously load Segment's analytics.js library
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="3.1.0";
analytics.load("${ settings.NOTICES_SEGMENT_KEY | n, js_escaped_string }");
analytics.page();
}}();
// Note: user tracking moved to segment-io-footer.html
</script>
<script type="text/javascript">
// Asynchronously load Segment's analytics.js library
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="3.1.0";
analytics.load("{{ NOTICES_SEGMENT_KEY }}");
analytics.page();
}}();
</script>
<!-- end Segment -->
{% else %}
<!-- dummy Segment -->
<script type="text/javascript">
var analytics = {
track: function() { return; },
trackLink: function() { return; },
pageview: function() { return; },
page: function() { return; }
};
</script>
<script type="text/javascript">
var analytics = {
track: function() { return; },
trackLink: function() { return; },
pageview: function() { return; },
page: function() { return; }
};
</script>
<!-- end dummy Segment -->
{% endif %}
</head>
Expand Down

0 comments on commit 24ce106

Please sign in to comment.