Hi

I'd like to be able to install the php-ga library and use it on this Google Analytics module instead of the default cookie method. This would mean that instead of submitting tracking data to Google via a cookie, it's done directly in PHP server side - without sending cookies to the end user. There are limitations to this method, but being able to submit to Google server side will be beneficial for sites where the restricted use of cookies is required.

- php-ga would be stored in /sites/all/libraries
- Instructions to load this would be placed on the admin page for the module
- if the library is found, an option to enable the server side method would be presented
- if the server side submission method is enabled, then instead of issuing a tracking cookie, the module would submit the tracking data on page load, directly to Google.

I'm creating a patch that does the above, with very basic submission processing (at the moment it ignores all the settings in the google analytics module and submits stats for every page). I'll upload the patch shortly...

I have a site demonstrating this at http://php-ga.openit4u.com/ and can give people read only access to the analytics if they contact me with their google id.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Matt B’s picture

Patch attached - I've not created one for a while, so hopefully I got it right!

hass’s picture

Category: feature » support
Status: Active » Fixed

I guess you are looking for http://drupal.org/project/gaservice . The patch looks also invalid.

Matt B’s picture

Status: Needs work » Fixed

Thanks hass. I didn't find the gaservice module when I searched, it's a shame there is no d7 version! It appears to be aimed at mobile websites and services, whereas I would like to use server side analytics for all websites. I guess the same method of using googles mobile api might work in the way I've integrated php-ga, but it would need looking into. I'm curious as to why there are two Google Analytics modules? I like the Google Analytics modules admin options, most of which can be used regardless of using the client or server side method.

I'll look at the patch, it's the first time I've created one using git - anything in particular that makes it look invalid?

Matt B’s picture

Status: Fixed » Needs work

Not fixed as gaservice is drupal 6 only.

Matt B’s picture

Status: Fixed » Needs work
FileSize
25.19 KB

Updated patch attached - I've successfully tested applying it, so it should be ok this time...

hass’s picture

Only for the reason that gaservice has no release makes no point to reopen an issue here as it's a different queue. The reason I have not integrated it yet are these 27 installations and that the request came from people how have not understood the reasons for it. It's something that has no usage and all browsers of this world - also on smartphones have javascript. I'm not sure why you think you need this. I believe you don't need this. It makes no sense to produce very high server side traffic for a normal website. The ONLY use case for the PHP version on server side are smartphone APPs.

Your code contains TABs and changes tons of unrelated lines, changes update hooks, and so on and so on.

Matt B’s picture

Apologies for the tabs and so on, it was probably the text editor I used, I'll see if I can do.

I need this to reduce my dependency on cookies, but it sounds like thus is a feature you don't want?

generalredneck’s picture

I just found this issue while I was mulling around. Maybe this will help you with what you need for the moment.

http://drupal.org/node/1643382#comment-6129396

I set up an issue on gaservice to "advertise" that I was working on Drupal 7 code for gaservice. I'm trying to get an official release for it out but until then, you can download the snapshot if you want to test it out and see if it fits your needs.

Reading your issue though, I'm not sure even my help will help for your use case unless you are using the services 3 module. GA Service is intended to be used by sites trying to keep tabs on the traffic generated from their apis, such as the case with iphone development and remote rest api usage. Gives you and idea of who is using your apis most.

iamEAP’s picture

Just doing some research in this area and took a look at the last patch. It's not going to work for the majority of production sites due to Drupal's page cache. (Didn't take that thorough of a look, but I'd bet it wouldn't work at all if Drupal were behind, e.g. Varnish.)

If you wanted the server side option to work, you'd want to do all of your logic in a hook_exit call (but as I said, Varnish and similar HTTP accelerators would be virtually unsupportable.

Matt B’s picture

Status: Needs work » Closed (won't fix)

I'm closing this as I don't think it'll go anywhere - gaservice might be a better solution. Thanks for looking at it!