Merge lp:~davidc3/developer-ubuntu-com/analytics-exclude-cn-domain into lp:developer-ubuntu-com

Proposed by David Callé on 2015-10-27
Status: Merged
Approved by: Daniel Holbach on 2015-10-29
Approved revision: 157
Merged at revision: 157
Proposed branch: lp:~davidc3/developer-ubuntu-com/analytics-exclude-cn-domain
Merge into: lp:developer-ubuntu-com
Diff against target: 30 lines (+6/-2)
1 file modified
templates/website_base.html (+6/-2)
To merge this branch: bzr merge lp:~davidc3/developer-ubuntu-com/analytics-exclude-cn-domain
Reviewer Review Type Date Requested Status
Daniel Holbach (community) 2015-10-27 Approve on 2015-10-29
Review via email: mp+275887@code.launchpad.net

Description of the Change

Condition analytics js to avoid loading on cn.developer.ubuntu.com

To post a comment you must log in.
157. By David Callé on 2015-10-29

Change for a method that works outside Firefox

Daniel Holbach (dholbach) wrote :

Thanks. Approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'templates/website_base.html'
2--- templates/website_base.html 2015-10-26 16:06:16 +0000
3+++ templates/website_base.html 2015-10-29 15:51:11 +0000
4@@ -35,8 +35,10 @@
5 {% render_block "css" %}
6
7 <script type="text/javascript">
8+ if(window.location.href.indexOf("cn.developer.ubuntu.com") == -1){
9 window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var n=t.forceSSL||"https:"===document.location.protocol,a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=(n?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+e+".js";var o=document.getElementsByTagName("script")[0];o.parentNode.insertBefore(a,o);for(var r=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["clearEventProperties","identify","setEventProperties","track","unsetEventProperty"],c=0;c<p.length;c++)heap[p[c]]=r(p[c])};
10 heap.load("3280028620");
11+ }
12 </script>
13
14 </head>
15@@ -46,11 +48,13 @@
16 <!-- Google Tag Manager -->
17 <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-K9KCMZ"
18 height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
19- <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
20+ <script>if(window.location.href.indexOf("cn.developer.ubuntu.com") == -1){
21+ (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
22 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
23 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
24 '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
25- })(window,document,'script','dataLayer','GTM-K9KCMZ');</script>
26+ })(window,document,'script','dataLayer','GTM-K9KCMZ');
27+ }</script>
28 <!-- End Google Tag Manager -->
29
30 {% cms_toolbar %}

Subscribers

People subscribed via source and target branches