homepage Welcome to WebmasterWorld Guest from 54.163.91.250
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque

Webmaster General Forum

    
Don't load http tracker on an https page?
Tonearm




msg:4422756
 6:47 pm on Feb 28, 2012 (gmt 0)

I've just set up Piwik on my server and I see that the Javascript snippet loads a PHP tracker via http in a noscript block in case the client doesn't execute Javascript. Should that tracker be requested via https if the main page request is via https in order to avoid browser warnings?

I also wonder if loading the tracker is slowing my site down at all. I'm wary of loading trackers which call out to other websites because of the possible slowdown, but if my website is www.example.com and the tracker is www.example.com/tracker.php, there shouldn't be the same potential for slowdown, right?

 

Tonearm




msg:4422853
 9:50 pm on Feb 28, 2012 (gmt 0)

How about changing the noscript link to be relative instead of absolute so it's served via http or https depending on how the page is served? Would that work?

Tonearm




msg:4423129
 3:24 pm on Feb 29, 2012 (gmt 0)

Does this even matter? Don't some browsers display a warning if an https page loads http content?

enigma1




msg:4423528
 10:44 am on Mar 1, 2012 (gmt 0)

Yes if your are on a secure page then side resources should be loaded with the secure protocol.

With PHP you can detect the secure port for instance getenv('SERVER_PORT') == '443' and include the http or https accordingly.
With js could check the window.location.protocol if it's https

For loading times depends what the tracker does. You can use client side triggering so js can do an ajax request to track something which can happen after the whole page is loaded. Or you can use the server script when the request is made and then customize the piwik to process it that way directly from your php. But by default the piwik triggers with client scripts.

Tonearm




msg:4423731
 5:57 pm on Mar 1, 2012 (gmt 0)

Yes if your are on a secure page then side resources should be loaded with the secure protocol.

Should relative links do the trick?

You can use client side triggering so js can do an ajax request to track something which can happen after the whole page is loaded. Or you can use the server script when the request is made and then customize the piwik to process it that way directly from your php.

I've read that the Piwik client script provides more information than the server-side APIs.

enigma1




msg:4423766
 6:41 pm on Mar 1, 2012 (gmt 0)

yes relative paths work alright.

For the piwik with js its easier but you feed data for clients with js enabled. With the server side you can feed it with all the requests including bots and since its open source unlike ga you can customize it and get better info.

Tonearm




msg:4423892
 11:21 pm on Mar 1, 2012 (gmt 0)

Thanks enigma1. In addition to being easier to implement, I've read in the Piwik forums that the Javascript snippet provides more data than the server-side APIs. As you pointed out, it does require that the client executes Javascript.

Alex_TJ




msg:4427581
 6:38 pm on Mar 10, 2012 (gmt 0)

Might be worth flagging up as a bug or feature request over on the Piwik site. I hadn't noticed this before on my install.

Tonearm




msg:4428182
 4:51 pm on Mar 12, 2012 (gmt 0)

Might be worth flagging up as a bug or feature request over on the Piwik site. I hadn't noticed this before on my install.

Well, their Javascript snippet uses absolute paths in case the user wants to install Piwik on a different system than the one running the website. I do think they should provide two versions of the snippet, one with absolute paths and one with relative, but they would probably reject that idea for simplicity reasons.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved