hello,
I am integrating Piwik in my Mobile application made in Ionic using angularJS. I had integrated using angurlatics but for some scenarios it is not suitaable for me. I have used the piwik.js directly in my Script tag
My first question is how do i invoke the Piwik Tracker using AngularJS . Has anyone tried it before ? Since the piwik javascript is non angular.
I had used the below code in my angular controller, but i dont see any request sent to my piwik server. But if I use the Script tag which is provided by Piwik and similar to below working one , i see the request is sent. I am not sure what is stopping the request to be sent to the server using my javascript code.
Working-----------------
<script src="libs/piwik/angulartics.js"></script>
<script src="libs/piwik/angulartics-piwik.js"></script>
<script src="libs/piwik/piwik.js"></script>
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u="//piwik-YYYYYY.YYYY.com/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
})();
</script>
NOT Working --------------------
/** Initialize Piwik **/
var initPiwik = function(user){
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
var u="//piwik-YYYYYYYY.YYYYYY.com/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
_paq.push(['setUserId', user]);
//Have commented this since i have used the piwik js in my script tag
// var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
// g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
};
Can anyone provide any pointers?
regards
Felix
I am integrating Piwik in my Mobile application made in Ionic using angularJS. I had integrated using angurlatics but for some scenarios it is not suitaable for me. I have used the piwik.js directly in my Script tag
My first question is how do i invoke the Piwik Tracker using AngularJS . Has anyone tried it before ? Since the piwik javascript is non angular.
I had used the below code in my angular controller, but i dont see any request sent to my piwik server. But if I use the Script tag which is provided by Piwik and similar to below working one , i see the request is sent. I am not sure what is stopping the request to be sent to the server using my javascript code.
Working-----------------
<script src="libs/piwik/angulartics.js"></script>
<script src="libs/piwik/angulartics-piwik.js"></script>
<script src="libs/piwik/piwik.js"></script>
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u="//piwik-YYYYYY.YYYY.com/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
})();
</script>
NOT Working --------------------
/** Initialize Piwik **/
var initPiwik = function(user){
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
var u="//piwik-YYYYYYYY.YYYYYY.com/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
_paq.push(['setUserId', user]);
//Have commented this since i have used the piwik js in my script tag
// var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
// g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
};
Can anyone provide any pointers?
regards
Felix