Request – CDN Support
-
Is CDN supported ? I have read in a old topic that it should but what i can see it dont use my CDN. Do i need to change some file so the js files is loaded over my cdn?
-
WP-Piwik supports CDNs:
- Go to Settings -> WP-Piwik -> Enable Tracking and enable tracking via WP-Piwik.
- Go to Expert Settings
- Here you can enter your CDN URL and (if necessary) a separate SSL CDN URL Don’t add the protocol (https:// or https://) here (e.g., use cdn.example.com instead of https://cdn.example.com).
- Save settings & check tracking code.
(If you choose to enter a tracking code manually, you have to change the JS code on your own, of course.)
It dont work to 100%
when i do this it say that it dont find the piwik.js file any more when i check my site whit help off Pingdom tools
https://tools.pingdom.com/fpt/#!/egLLMF/https://www.myabdllife.com/
Which tracking code mode are you using?
Did you test the generated link manually? E.g., in standard mode try to open HTTP:// + the URL you entered as CDN URL + /piwik.js – if the script file is not available, you should check your CDN URL.
I use the Default tracking.
The file is here: https://piwik.myabdllife.com/piwik/piwik.js
So i am not sure if the CDN have been able to store it.
My code look like this:
<!– Piwik –>
<script type=”text/javascript”>
var _paq = _paq || [];
_paq.push([“setCookieDomain”, “*.www.myabdllife.com”]);
_paq.push([‘trackPageView’]);
_paq.push([‘trackAllContentImpressions’]);
_paq.push([‘enableLinkTracking’]);
(function() {
var u=”//piwik.myabdllife.com/piwik/”;
_paq.push([‘setTrackerUrl’, u+’piwik.php’]);
_paq.push([‘setSiteId’, 1]);
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);
})();
</script>
<!– End Piwik Code –>The tracking code does not contain the CDN part:
var _paq = _paq || []; _paq.push(["setCookieDomain", "*.192.168.33.10"]); _paq.push(['trackPageView']); _paq.push(['trackAllContentImpressions']); _paq.push(['enableLinkTracking']); (function() { var u="//my_piwik_url/"; _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setSiteId', 1]); var ucdn=(('https:' == document.location.protocol) ? 'https://www.example.com/' : 'https://www.example.com/'); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.defer=true; g.src=ucdn+'piwik.js'; s.parentNode.insertBefore(g,s); })();
These lines are necessary:
var ucdn=(('https:' == document.location.protocol) ? 'https://www.example.com/' : 'https://www.example.com/'); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.defer=true; g.src=ucdn+'piwik.js';
Please check the WP-Piwik tracking code preview and also check if the CDN URL is properly entered and saved. The tracking code above was created with standard tracking, cookie domain, content tracking & example.com CDN.
I have enter the right address
<!– Piwik –>
<script type=”text/javascript”>
var _paq = _paq || [];
_paq.push([“setCookieDomain”, “*.www.myabdllife.com”]);
_paq.push([‘trackPageView’]);
_paq.push([‘trackAllContentImpressions’]);
_paq.push([‘enableLinkTracking’]);
(function() {
var u=”//piwik.myabdllife.com/piwik/”;
_paq.push([‘setTrackerUrl’, u+’piwik.php’]);
_paq.push([‘setSiteId’, 1]);
var ucdn=((‘https:’ == document.location.protocol) ? ‘https://myabdllifecom.r.worldssl.net/’ : ‘https://myabdllifecom.r.worldssl.net/’);
var d=document, g=d.createElement(‘script’), s=d.getElementsByTagName(‘script’)[0];
g.type=’text/javascript’; g.async=true; g.defer=true; g.src=ucdn+’piwik.js’; s.parentNode.insertBefore(g,s);
})();
</script>
<!– End Piwik Code –>this is my cdn address: myabdllifecom.r.worldssl.net
I still end up whit the same problem.
Well, these URLs seem to be wrong:
https://myabdllifecom.r.worldssl.net/piwik.js
redirects tohttps://www.myabdllife.com/piwik.js
(404 not found)and
https://myabdllifecom.r.worldssl.net/piwik.js
also redirects tohttps://www.myabdllife.com/piwik.js
(404 not found).So your tracking code can’t work, of course.
Yes i know that. I think it is becours
the file is here: https://piwik.myabdllife.com/piwik/piwik.js
Like i sad before. But i donw know how i can get this to work whit my CDN. When piwik is on a sub domain that is not cached by my cdn host. But i dont know how i can get the CDN to cache the Piwik files.
Please refer to your CDN documentation or ask your CDNs support about this.
WP-Piwik can just offer a feature to use a CDN URL, but I can’t tell you how the CDN itself has to be configured, of course. Sorry!
I use https://cdnsun.com/
They dont have any documentation when it comes how to setup Piwik together whit CDN.
I’m sorry, but I can just suggest your CDNs support. Or try to ask the Piwik community, maybe they have an idea how to configure your CDN: https://forum.piwik.org
This support forum is just about the WordPress plugin WP-Piwik. If I had knowledge about CDNs, I would appreciate to help you… but I haven’t.
Hi breakling. Just to confirm from the information you provided above, when you go into:
* Expert Settings in WP-Piwik Settings
for the “CDN URL https://: ” would you just put in the full URL (without the https:// ) to the piwik.js script?
Yes. WP-Piwik will take care of the protocol.
- The topic ‘Request – CDN Support’ is closed to new replies.