Hi guys,

We have a Piwik JavaScript Tracking Code (generated by Piwik itself) which 
works well when hard coded in a test.html page.  The test.html page is as 
follows:

<head>
</head>

<body>


<!-- Piwik -->

<script type="text/javascript">

  var _paq = _paq || [];

  _paq.push(['trackPageView']);

  _paq.push(['enableLinkTracking']);

  (function() {

    var u=(("https:" == document.location.protocol) ? "https" : "http") + 
"://samsclothingstore.com/piwik/";

    _paq.push(['setTrackerUrl', u+'piwik.php']);

    _paq.push(['setSiteId', 5]);

    var d=document, g=d.createElement('script'), 
s=d.getElementsByTagName('script')[0]; g.type='text/javascript';

    g.defer=true; g.async=true; g.src=u+'piwik.js'; 
s.parentNode.insertBefore(g,s);

  })();

</script>


<!-- End Piwik Code -->


</body>





However, when we add the tracking code into Greasemonkey userscript, it 
stops firing. (The userscript can prints out "start", "inside function", 
and "finish" as expected). The userscript is as follows:

// ==UserScript==
// @name        Test
// @namespace   test.com
// @description my test
// @include     http://www.solesportsrunning.com/*
// @version     1
// @grant       none
// ==/UserScript==

 

alert("start")

// <!-- Piwik -->
// <script type="text/javascript">
    
  var _paq = _paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u=(("https:" == document.location.protocol) ? "https" : "http") + 
"://samsclothingstore.com/piwik/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', 5]);
    var d=document, g=d.createElement('script'), 
s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
    g.defer=true; g.async=true; g.src=u+'piwik.js'; 
s.parentNode.insertBefore(g,s);
      
      
    alert("inside function")
  })();


// </script>
// <!-- End Piwik Code -->

alert("finish")



 
Can anyone please offer some insights or comments? Thanks a lot for your 
help.


Ray


-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to