Project

General

Profile

« Previous | Next » 

Revision 54609

moved piwik script to index

View differences:

modules/uoa-repository-dashboard-gui/trunk/src/app/app.component.html
1 1
<div class="uk-offcanvas-content">
2 2
  <top-menu></top-menu>
3 3
  <router-outlet></router-outlet>
4

  
5
  <!-- Piwik -->
6
  <script type="text/javascript">
7
    var _paq = _paq || [];
8
    /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
9
    _paq.push(['trackPageView']);
10
    _paq.push(['enableLinkTracking']);
11
    (function() {
12
      var u="//analytics.openaire.eu/";
13
      _paq.push(['setTrackerUrl', u+'piwik.php']);
14
      if ( (window.location.origin).includes('beta') || (window.location.origin).includes('athenarc') ) {
15
        _paq.push(['setSiteId', '92']);
16
        console.log('92');
17
      } else {
18
        _paq.push(['setSiteId', '111']);
19
        console.log('111');
20
      }
21
      var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
22
      g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
23
    })();
24
  </script>
25
  <!-- End Piwik Code -->
26

  
27
  <div style="height: 0px">
28
    <!-- Piwik Image Tracker-->
29
    <img src="{{ piwikUrl }}" style="border:0" alt="" />
30
    <!-- End Piwik -->
31
  </div>
32

  
33

  
34 4
  <footer></footer>
35 5
  <cookie-law position="bottom">
36 6
    OpenAIRE uses cookies in order to function properly.<br>
modules/uoa-repository-dashboard-gui/trunk/src/app/app.component.ts
30 30
  }
31 31

  
32 32
  ngOnInit() {
33
    if ((window.location.origin).includes('beta') ||
33
    /*if ((window.location.origin).includes('beta') ||
34 34
        (window.location.origin).includes('athenarc') ) {
35 35
      this.piwikUrl = 'https://analytics.openaire.eu/piwik.php?idsite=92&rec=1';
36 36
    } else {
37 37
      this.piwikUrl = 'https://analytics.openaire.eu/piwik.php?idsite=111&rec=1';
38
    }
38
    }*/
39 39

  
40 40
    this.router.events.subscribe((evt) => {
41 41
      if (!(evt instanceof NavigationEnd)) {
modules/uoa-repository-dashboard-gui/trunk/src/index.html
50 50
    </div>
51 51
  </noscript>
52 52

  
53
  <!-- Piwik -->
54
  <script type="text/javascript">
55
    var piwikUrl;
56
    if ((window.location.origin).includes('beta') ||
57
      (window.location.origin).includes('athenarc') ) {
58
      piwikUrl = 'https://analytics.openaire.eu/piwik.php?idsite=92&rec=1';
59
    } else {
60
      piwikUrl = 'https://analytics.openaire.eu/piwik.php?idsite=111&rec=1';
61
    }
62
    // document.getElementById('piwikImg').setAttribute("src", piwikUrl);
63

  
64
    var _paq = window._paq || [];
65
    /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
66
    _paq.push(['trackPageView']);
67
    _paq.push(['enableLinkTracking']);
68

  
69
    (function() {
70
      /* CREATING PIWIK IMAGE */
71
      dv = document.createElement('div');
72
      dv.setAttribute('style', 'height:0px;');
73
      im = document.createElement('img');
74
      im.setAttribute('src', piwikUrl);
75
      im.setAttribute('style', 'border:0;');
76
      im.setAttribute('alt', '');
77
      dv.appendChild(im);
78
      document.appendChild(dv);
79

  
80

  
81
      /* ORIGINAL TRACKING SCRIPT */
82
      var u="//analytics.openaire.eu/";
83
      _paq.push(['setTrackerUrl', u+'piwik.php']);
84
      if ( (window.location.origin).includes('beta') || (window.location.origin).includes('athenarc') ) {
85
        _paq.push(['setSiteId', '92']);
86
        console.log('92');
87
      } else {
88
        _paq.push(['setSiteId', '111']);
89
        console.log('111');
90
      }
91
      var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
92
      g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
93
    })();
94
  </script>
95
  <!-- End Piwik Code -->
96

  
97
  <!-- PIEIK IMAGE IS NOW CREATED DYNAMICALLY USING JS -->
98
  <!--<div style="height: 0px">
99
    &lt;!&ndash; Piwik Image Tracker&ndash;&gt;
100
    <img id="piwikImg" src="https://analytics.openaire.eu/piwik.php?idsite=92&rec=1" style="border:0" alt="" />
101
    &lt;!&ndash; End Piwik &ndash;&gt;
102
  </div>-->
103

  
104

  
53 105
  <oa-repo-manager>
54 106
    <div uk-spinner="ratio: 2" class="uk-overlay uk-position-center uk-dark" style="margin: auto"></div>
55 107
  </oa-repo-manager>
56 108

  
57

  
58 109
</body>
59 110
</html>

Also available in: Unified diff