Tracking Code in html pages inconsistent

Bug #1325395 reported by Andreas Jaeger
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openstack-manuals
Fix Released
Medium
Christian Berendt

Bug Description

The various HTML pages contain uncommented Google Analytics setting as well as a search setting.

Somehow the code confuses me.

The uncommented one is (from trunk/index.html):
  <!--<script type="text/javascript">

   var _gaq = _gaq || [];
   _gaq.push(['_setAccount', 'UA-17511903-1']);
   _gaq.push(['_setDomainName', '.openstack.org']);
   _gaq.push(['_trackPageview']);

   (function() {
   var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
   ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
   var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
   })();

The used one is:
    <script type="text/javascript">
//<![CDATA[
                    google.load('search', '1', {
                        language: 'en'
                    });
                    var _gaq = _gaq ||[];
                    _gaq.push([ "_setAccount", "UA-17511903-1"]);
                    function _trackQuery(control, searcher, query) {
                        var gaQueryParamName = "q";
                        var loc = document.location;
                        var url =[
                        loc.pathname,
                        loc.search,
                        loc.search ? '&': '?',
                        gaQueryParamName == '' ? 'q': encodeURIComponent(gaQueryParamName),
                        '=',
                        encodeURIComponent(query)].join('');
                        _gaq.push([ "_trackPageview", url]);
                    }
                    google.setOnLoadCallback(function () {
                        var customSearchControl = new google.search.CustomSearchControl('011012898598057286222:elxsl505o0o');
                        customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
                        customSearchControl.setSearchStartingCallback(null, _trackQuery);
                        customSearchControl.draw('cse');
                    },
                    true);//]]>

Shouldn't the later use _setDomainName as well and is it correct that the _trackPageview is done inside the function?

Additionally some pages like sec/index.html use a different way to set the code.

I'd like to see the uncommented code removed, the used one verified for correctness and have the same example code used everywhere if possible.

Tags: doc-builds
Anne Gentle (annegentle)
Changed in openstack-manuals:
status: New → Confirmed
importance: Undecided → Medium
Tom Fifield (fifieldt)
tags: added: doc-builds
Changed in openstack-manuals:
assignee: nobody → Anne Gentle (annegentle)
milestone: none → juno
Revision history for this message
Tom Fifield (fifieldt) wrote :

Hi,

Any progress on consolidating the tracking codes?

Revision history for this message
Christian Berendt (berendt) wrote :

Because we now use a static page generator at least the code used on all webpages is the same. Please check the code inside the files www/templates/script_search.tmpl and www/templates/script_header.tmpl (the uncommented code).

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-manuals (master)

Fix proposed to branch: master
Review: https://review.openstack.org/120058

Changed in openstack-manuals:
assignee: Anne Gentle (annegentle) → Christian Berendt (berendt)
status: Confirmed → In Progress
Revision history for this message
Christian Berendt (berendt) wrote :

Removed the commented Java Script code. We still have to check if the content of www/templates/script_search.tmpl is correct.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-manuals (master)

Reviewed: https://review.openstack.org/120058
Committed: https://git.openstack.org/cgit/openstack/openstack-manuals/commit/?id=3a9f267bee09570f575f8293d2b3192efc007b69
Submitter: Jenkins
Branch: master

commit 3a9f267bee09570f575f8293d2b3192efc007b69
Author: Christian Berendt <email address hidden>
Date: Tue Sep 9 12:48:56 2014 +0200

    Remove commented JavaScript code from webpages

    Change-Id: I0a6d7517ed193f91d43679f19818e0a915c50c91
    Partial-Bug: #1325395

Tom Fifield (fifieldt)
Changed in openstack-manuals:
milestone: juno → kilo
Tom Fifield (fifieldt)
Changed in openstack-manuals:
milestone: kilo → liberty
Anne Gentle (annegentle)
Changed in openstack-manuals:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.