Giter VIP home page Giter VIP logo

google-measurement-php-client's People

Contributors

bthurlow avatar dan4cat avatar ins0 avatar jamiefdhurst avatar mablae avatar mtricht avatar reysharks avatar spekulatius avatar vogelito avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

google-measurement-php-client's Issues

semantic versioning

i will add semantic versioning for a clean update possibility for non bc updates etc.

Client ID

Hi,

Google Analytics recommends to use an rfc4122 UUID version 4 to identify the client.
https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#cid
Although this unique identifier doesn't seem to be yet implemented by Google, they let users set their own client id field:

ga('create', 'UA-XXXXXXX-X', {
    'clientId': '35009a79-1a05-49d7-b876-2b884d0f825b'
});

In order to be prepared for this future implementation and/or make your library compatible with developers that chose to set their own generated UUID, I think your createClientID function should try to guess what kind of UUID is set in the GA cookie. The current release causes a notice (Undefined offset: 3) because the parsing part of the function is trying to get something that's not set:

$gaCookie = explode('.', $_COOKIE['_ga']);
$clientId = $gaCookie[2] . '.' . $gaCookie[3];

Here's the cookie exploded array when a developer client id is set:

Array
(
    [0] => GA1
    [1] => 1
    [2] => 35009a79-1a05-49d7-b876-2b884d0f825b
)

Also, your library should let developers set the client ID if needed, createClientID should only be used when the client id is not set. Measurement protocol is intended to enable server to server client tracking but there's currently no way to link/merge client side data (source, campaign, etc.) with data sent by the measurement protocol as the createClientID will return an orphan UUID in a server to server request case.

Cheers,
N.

not declare a member variable

Hi
I think the need for a declaration in the following files:

Racecore/GATracking/Tracking/Ecommerce/Item.php
private $host = '';

Thanks for the useful library

Sessions versus events

Hi there,

We utilize this script to track events on the site. What we're seeing is that events are being tracked as sessions with the browser identified as "google-measurement-php-client". It's clear to me these aren't unique users, which is really what sessions are for in my experience. Is there a setting we can change so that events aren't recorded as sessions?

Thanks,
Craig

When Internet is not available socket_connect throws a 'Host name lookup failure' PHP error

In no Internet available condition, the socket_connect call in Socket.php createConnection function throws the following error:

A PHP Error was encountered
Servetity: Warning

Message: socket_connect(): Host loockup failed [-10002]: Host name lookup failure
Filename: Adapter/Socket.php

Line Number: 32

Backtrace:
[...]

that ignoring the possible false return, and any exception throwing and try&catch.

Is there any way to avoid that error message in that specific call?

Page View Missing parameters

Hi in your class "page" for page view tracking missing User Parameters.

It's important for tracking user's navigation.

[WIP] Refactoring this Repo

I'm currently refactoring the complete class, since the first release was working but not so well programmed.

Any suggestions would be very welcome :)

Unable to see submitted page view tracking on analytics

Hi,

i've tried to use this php class to send a test pageview on my analytics account from the website.

You can see in the attached image the header, the content, and the response (the array).

Why I don't see the page view on my analytics account?

senza nome-1

CLOSED: I didn't converted my account to Universal Analyicts :)

Problem after upgrading from version 2.1.0 to 2.1.1

Hi,

I was using the 2.1.0 package successfully and my custom events were being sent properly.
Back on the 26th of April I updated to the latest version available (2.1.1) and since then the sending of events didn't work. We only noticed recently and it now all works again after downgrading.

The complete error message in my logs is:
socket_write(): unable to write to socket [32]: Broken pipe /home/xxx/xxx/vendor/ins0/google-measurement-php-client/src/Racecore/GATracking/Client /Adapter/Socket.php 62

I have looked around but I cannot find anything in particular so I'd appreciate it if someone could have a look.

  • Alex

Added all missing Parameters

check the dev branch feature-parameters - i added all missing measurement parameters. this pre release should bc with the current release without the Campaign class (dropped), these function is now embedded under all tracking types.

the example files are yet not updated. i need to restructure the hole tracking classes to allow maxium dynamically between all parameters and hit types.

please check it out and give a short comment here - thanks all

https://github.com/ins0/google-measurement-php-client/tree/feature-parameters

Send IP address

Hello!

First of all, thank you for this nice tool. I prefer it over other the alternatives because it is simple and lightweight. Well done!

Now, as for the issue: would it be possible to support in GMPC the IP override parameter? I am referring to the 'uip' parameter from https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#uip.

A bit of context. I often set IP-based filters in my GA views. When I use GMPC, however, the IP sent to GA seems to be the server IP rather than the client IP.

If needed, I have written a function based on a Stack Overflow answer in order to extract the client IP; you can find the function here: https://gist.github.com/coccoinomane/4c420776dc16d80ea772aff06d3e1ef4

Thank you,
Guido

Ecommerce parameters

Hi,

I'm using your library in a project I'm working on right now. Works perferctly. Thanks for sharing this !
I have a few questions about transaction/item parameters for ecommerce tracking.

Suddendly stopped working - Analytics Host not reachable!

After years of honoured service, the library is throwing this error:

[01-Jul-2019 09:21:16 UTC] PHP Fatal error:  Uncaught Racecore\GATracking\Exception\EndpointServerException: Analytics Host not reachable! Error: Connection timed out in /home/meat/public_html/wp-content/plugins/wordpress-analytics/vendor/ins0/google-measurement-php-client/src/Racecore/GATracking/Client/Adapter/Socket.php:35

I first thought the problem was due to the GA-collect endpoint being hard-coded without HTTPS, but fixing that does not fix the error.

Does anybody have the same issue?

Cheers,
Guido

sendMultipleTracking problems

Hello.
When I trying to use sendMultipleTracking from your example the code are hanging forever in
Racecore\GATracking\Client\Adapter\Socket@readConnection method.
When I use simple sendTracking it work correct. any ideas?

GA Cookie

Hello,

with the new Universal Analytics code you have no more a "__umta" cookie but a single "_ga", so the current code for retrieving the Client ID from the cookie is wrong.

I've created a fork ( https://github.com/reysharks/google-measurement-php-client ) changing this behaviour and adding some Commerce Transaction features.

This is the code for retrieving the correct Analytics Client ID

       list($version,$domainDepth, $cid1, $cid2) = split('[\.]', $_COOKIE["_ga"],4);
       $contents = array('version' => $version, 'domainDepth' => $domainDepth, 'cid' => $cid1.'.'.$cid2);
       $clientId = $contents['cid'];

Thank you for starting this project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.