SSL-Prefix at HostEurope ssl.webpack.de


#1

Hello to all members, my newbie post regarding Piwik…:)-D

There is a question about including Piwik’s javascript code to a website hosted by HostEurope:

They are offering a SSL-Proxy which adds a url prefix in case of secure SSL connection.

So url http://domain.de will be changed to
https://ssl.webpack.de/domain.de/

Will this modified tracking code work for normal and ssl-secured connections?


<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://ssl.webpack.de/domain.de/script/piwik/" : "http://domain.de//script/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script>
<noscript><p><img src="http://www.praxis-wiesbaden.de/script/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->

There is a FAQ Installation - Analytics Platform - Matomo
Switching between normal and ssl can be done with:


if( isset( $_SERVER['HTTP_X_FORWARDED_SERVER'] ) ) 
  $URLID = 'https://ssl.webpack.de/'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
else
  $URLID = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];


Thanks for any hint, best regards!


#2

Ok, I did explorate some settings. This code works even for http:// and https:// connections on HostEurope webpack.
But if switching between normal and secure page version, same page is counted twice…
How to solve?


<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://ssl.webpack.de/domain.de/piwik/" : "http://domain.de/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script>
<noscript>
<p><img src="<?php echo $servername; ?>piwik/piwik.php?idsite=1&rec=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->