Commit 86e928ba1c1788450e08999114884810f6bb7af3

Authored by Julien Verneuil
1 parent a98b83da

make "piwik_js_code" function return HTML_Head_Tag (meta) instead of a String

Showing 1 changed file with 21 additions and 19 deletions   Show diff stats
web/piwik/CXM_piwik.anubis
... ... @@ -11,31 +11,33 @@
11 11 * To change this template use Tools | Options | Coding | Edit Standard Headers.
12 12 */
13 13  
  14 +read calexium_lib/web/CXM_making_a_web_site.anubis
14 15 read tools/basis.anubis
15 16  
16 17 // this js code is to include in the <head> section of a webpage, it enable Piwik tracking for the given site/domains (Note: Only if the website was added to the Piwik tracker)
17   -public define String
  18 +public define HTML_Head_Tag
18 19 piwik_js_code
19 20 (
20 21 String piwik_tracker,
21 22 Int site_id,
22 23 List(String) piwik_domains
23 24 )=
24   - "
25   - <!-- Piwik -->
26   - <script type=\"text/javascript\">
27   - var _paq = _paq || [];
28   - _paq.push([\"setDomains\", [" + concat(piwik_domains, ",") + "]]);
29   - _paq.push(['trackPageView']);
30   - _paq.push(['enableLinkTracking']);
31   - (function() {
32   - var u=\"//" + piwik_tracker + "/\";
33   - _paq.push(['setTrackerUrl', u+'piwik.php']);
34   - _paq.push(['setSiteId', " + site_id + " ]);
35   - var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
36   - g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
37   - })();
38   - </script>
39   - <noscript><p><img src=\"//" + piwik_tracker + "/piwik.php?idsite=" + site_id + "\" style=\"border:0;\" alt=\"\" /></p></noscript>
40   - <!-- End Piwik Code -->
41   - ".
  25 + meta(literal(
  26 + "
  27 + <!-- Piwik -->
  28 + <script type=\"text/javascript\">
  29 + var _paq = _paq || [];
  30 + _paq.push([\"setDomains\", [" + concat(map((String domain) |-> "\"" + domain + "\"", piwik_domains), ",") + "]]);
  31 + _paq.push(['trackPageView']);
  32 + _paq.push(['enableLinkTracking']);
  33 + (function() {
  34 + var u=\"//" + piwik_tracker + "/\";
  35 + _paq.push(['setTrackerUrl', u+'piwik.php']);
  36 + _paq.push(['setSiteId', " + site_id + " ]);
  37 + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
  38 + g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
  39 + })();
  40 + </script>
  41 + <noscript><p><img src=\"//" + piwik_tracker + "/piwik.php?idsite=" + site_id + "\" style=\"border:0;\" alt=\"\" /></p></noscript>
  42 + <!-- End Piwik Code -->
  43 + ")).
... ...