Support forums : Branches

mobile detection and hit logging

Discussion about existing branches and the directions they need to go in, or, for branches that are going to happen. "Quickies" is wide open. "Branches" is more focused.

Moderator: Dracones

mobile detection and hit logging

Postby EdB » Tue Aug 07, 2012 5:06 am

Been thinking about mobile devices a bit, and looking at the Hit class. Seems to me we could pretty much overhaul the Hit class with http://code.google.com/p/php-mobile-detect/

Do the antispam thing immediately, then if we're still a hit find out if we're phone or tablet or desktop, then potentially output a new file accordingly. mobile.main.php for example.

Also goes to overhauling stats a wee bit, but I haven't gotten that far in my mind yet. Trying to wrap my brain around a PHP Warning in my root level error_log that happens every hour on the hour and at no other times, but doesn't happen on all installs on that same server. hmmm....
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: mobile detection and hit logging

Postby leeturner » Tue Aug 07, 2012 8:59 am

[quote="EdB" then if we're still a hit find out if we're phone or tablet or desktop, then potentially output a new file accordingly. mobile.main.php for example.[/quote]

I like the mobile.main.php idea !!!!
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK

Re: mobile detection and hit logging

Postby Kimberly » Wed Aug 08, 2012 2:31 am

Now this sounds interesting. My sister was looking at my garden site which I have not converted yet; just too lazy, and it was having problems displaying correctly. Since there are several mobile devices and some four or six smartphone mobile devices with web browsers; is there some basic configuration among them that can be used? Where do we go to learn about creating mobile devices friendly websites? Personally, with a three inch display I think the whole smartphone mobile web is BS; however, people are jumping on that wagon in droves so we do need to give some consideration to it.
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: mobile detection and hit logging

Postby EdB » Wed Aug 08, 2012 3:01 am

Go to http://1912webworks.com/mobile/demo.php and you'll see what that class can show us. Bottom line is it gives a really quick "is mobile/tablet/desktop", then all sorts of details about what exactly the device is ... unless it is a desktop. For some reason I just went there through 2 browsers and it said false for both. hmmm...

Anyway searching for what the deal is told me some stuff that I figured mattered. Bandwidth is the most important issue, but sideways navigation is a close second. So probably ditch the entire sidebar on a mobile device, and scale attached images down to a really small size. Use display:block on stuff you are going to link so the clickable area is larger than the text, scale down any paddings and margin so the person doesn't have to swipe past blank space. Pixels matter a whole lot on a small screen. Oh and telephone numbers & addresses should be prominent - especially phone numbers cuz the hand held device PROBABLY has a phone feature ;) Oh and apparently html5 has a shedload of type attributes for form fields that trigger different on-screen keyboards for some hand helds. Like if the type is "tel" it'll give a number keypad. Browsers that don't understand those types assume "text" so it downgrades nicely.

Not every site should have a "mobile friendly" IMHO, but for those that do it'd be cool to offer. Like a business wants calls or visits, so make sure the phone number and address (google map link?) are prominent. Much more important than the pages and contents links eh? I mean, all the good stuff will be read when they are at home. On the hand held it is probably more important to get them in touch with the physical world the website represents.

Or something like that.
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: mobile detection and hit logging

Postby leeturner » Wed Aug 08, 2012 11:38 am

EdB wrote:Not every site should have a "mobile friendly" IMHO, but for those that do it'd be cool to offer .


Couldn't agree more. The big question is how far we take it :D

For example, we can do the mobile.main.php which will make a nice mobile template for when the site is viewed by a mobile device but I might want to develop a different interface for iPhone/ipad that makes use of the specific safari mobile bits. It might be that it can all be done with the correct css on mobile.main.php but I wonder how fine grained we could make it? Maybe a iphone.main.php or iOS.main.php or AndroidOS.main.php. Not sure whether it would work or whether it is a good idea but just thinking out load really.

L
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK

Re: mobile detection and hit logging

Postby EdB » Wed Aug 08, 2012 4:20 pm

The only thing special about a mobile.main is that it would be "cored" along the line of index.main and page.main and so forth in the $disp_handlers array. In theory we could build a world where a template author could get all sorts of smart, and in truth we might even be there now, but right now we can't do step one.

BackStory: Way long ago all hit actions were done before the page loaded. It got moved to the ass end of page generation for server-side speed performance. Then antispam got moved to the front end again for server load reduction - no sense in generating a page for a spammer eh? Right now all we figure out is 'referer_type' when the hit first comes in. Everything else is after page generation.

Therefore to give template authors a mobile.main option we would have to do more work on the user agent string up front. And if we do any we might as well do all, so the tightly-focused template author would have accurate info for these bits in the hit class:
Code: Select all
$this->agent_type = 'unknown';
$this->agent_name = '';
$this->agent_platform = '';

Maybe more depending on how it actually works out.

Anyway we still do the hit storing later - we just learn what we can and make that info available to the template author right away. Err... AFTER deciding if the hit is a spammer or is an admin page.
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: mobile detection and hit logging

Postby leeturner » Wed Aug 08, 2012 5:09 pm

Sounds like a good plan to me :D
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK

Re: mobile detection and hit logging

Postby EdB » Wed Aug 08, 2012 6:27 pm

I'll make a branch for it which will be really hard to test because it'll have to be installed for real so it can be accessed via a mobile device.

I wish I had a better handle on the whole $Timer thing because I really would like to know how much more time it will take to run that class/checks immediately instead of at the end :(
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: mobile detection and hit logging

Postby Kimberly » Wed Aug 08, 2012 9:54 pm

It can also be used to block certain devices; mmmm... ;)

I could serve up a notice "No crappy iPads are allowed to connect to my site" :D
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: mobile detection and hit logging

Postby EdB » Wed Aug 08, 2012 11:24 pm

Yep :)

Or you could say to an iPad user "I see you have Samsung's extremely cool tablet ... "

Or you could have a renderer that puts an "i" in front of every Capital letter (making that iCapital letter ;) )

(I kinda like that one ... )

I'm thinking right now that maybe I should add a checkbox on Global settings for "early device detection" with a note that says it is required if you want to serve different content to a mobile device and will slow down server performance by a wee tiny bit. That way if you've got no interest in that you leave it un-checked.
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Next

Return to Branches

Who is online

Users browsing this forum: No registered users and 1 guest

cron