Giter Club home page Giter Club logo

php-ga's People

Contributors

fbricker avatar jorgetutor avatar thomasbachem 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  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  avatar  avatar

Watchers

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

php-ga's Issues

Abandoned¿?

Last commit is from November 2015, there are 8 pull requests open. Has the library been abandoned?

Error when pulling using Composer

Environment: Pagodabox

Composer.json:
"united-prototype/php-ga": "dev-composer",

On push to server, composer errors out like so:

  -   Failed to clone https://github.com/Fran6co/php-ga.git via git, https protocols, aborting.                       
  -                                                                                                                   
  -   - git://github.com/Fran6co/php-ga.git                                                                           
  -     fatal: remote error:                                                                                          
  -       Repository not found.                                                                                       
  -                                                                                                                   
  -   - https://github.com/Fran6co/php-ga.git                                                                         
  -     error: The requested URL returned error: 403 while accessing https://github.com/Fran6co/php-ga.git/info/refs  
  -                                                                                                                   
  -     fatal: HTTP request failed     

track file only if user request

Ive implemented this for mp3 files which works great, but im also including the mp3's on the site in the default html audio player. This no longer works with the added tracking to all mp3 files. Any fix I could do to exclude requests coming from the same server or similar?

thanks

About social network clicks

How we send info if the user come from social networks? for example if user clicks shared link in facebook, how works php-ga in that time, can it send information about the click?

Does this library support Enhanced Ecommerce

Hi,

I'm working on a project to implement Enhanced Ecommerce. We want to use this library to also register the ordered products through our API and I'm wondering if this library also supports Enhanced Ecommerce instead of Ecommerce.

Thanks in advance!

Sven Buijsrogge

Send trackPageview : setReferrer is set , but referrer not displayed on GA

I'm using Php-ga for a tinyurl redirect service and i'm having problems passing on the referrer data to G.A. (utmr=facebook f.e....).

After looking into it, Php ga builds the correct object right till the HTTP Request to Google with the proper parameter set ("utmr=refer_x"), but then it just doesn't show up on G.A.!

Setting this referrer variable into any other G.A. parameter (f.e. Page title) will be displayed successfully..

Any one experienced such problem?
Many thanks

Code Example: setcookie and increment visitCount

it's a great library, just implemented it for our xml-newsfeed transported to a Mac App.

Biggest step was to implement the returning visitor count.

Now this is either a feature request for php-ga or for it's documentation:

Why would I have to do the increment of returning visits in my code? Why isn't this done inside tracker?

Now:
$isNewVisitor = true;
if ($_COOKIE['__utma']) {
$visitor->fromUtma($_COOKIE['__utma']);
$isNewVisitor = false;
}

if($isNewVisitor) {
    // all defaults are set when Visitor is inited
    // dont know how to get account hash from tracker...
    // $utmaContent = array( '217597461', $visitor->getUniqueId(), $visitor->getFirstVisitTime()->getTimeStamp(), $visitor->getPreviousVisitTime()->getTimeStamp(), $visitor->getCurrentVisitTime()->getTimeStamp(), $visitor->getVisitCount());
} else {
    $visitor->setVisitCount( $visitor->getVisitCount() + 1);
}

$utmaContent = array( '217597461', $visitor->getUniqueId(), $visitor->getFirstVisitTime()->getTimeStamp(), $visitor->getPreviousVisitTime()->getTimeStamp(), $visitor->getCurrentVisitTime()->getTimeStamp(), $visitor->getVisitCount());
$utmaContent = implode('.', $utmaContent);

$cookieSet = setcookie('__utma', $utmaContent, strtotime('+2 years'));

New:

  • a wrapper for setcookie can be called somehow thru Tracker or so
  • increment for pageview can be done with php-ga

HTTP proxy support

The attached patch adds simple http proxy support.

diff --git a/php-ga/src/GoogleAnalytics/Config.php b/php-ga/src/GoogleAnalytics/Config.php
index 7f19142..c0b51f0 100644
--- a/php-ga/src/GoogleAnalytics/Config.php
+++ b/php-ga/src/GoogleAnalytics/Config.php
@@ -113,6 +113,14 @@ class Config {
         * @var string
         */
        protected $endPointHost = 'www.google-analytics.com';
+
+       /**
+        * Connect to $endPointHost through this proxy
+        *
+        * @see Internals\Request\HttpRequest::send()
+        * @var string
+        */
+       protected $httpProxy = null;

        /**
         * Google Analytics tracking request endpoint path
@@ -290,6 +298,21 @@ class Config {
                $this->sitespeedSampleRate = (int)$sitespeedSampleRate;
        }

+       /**
+        * @return string
+        */
+       public function getHttpProxy() {
+               return $this->httpProxy;
+       }
+
+       /**
+        * @param string $host
+        * @param int $port
+        */
+       public function setHttpProxy($host, $port) {
+               $this->httpProxy = sprintf('%s:%d', $host, $port);
+       }
+
 }

 ?>
\ No newline at end of file
diff --git a/php-ga/src/GoogleAnalytics/Internals/Request/HttpRequest.php b/php-ga/src/GoogleAnalytics/Internals/Request/HttpRequest.php
index 2ba81ae..60bf47a 100644
--- a/php-ga/src/GoogleAnalytics/Internals/Request/HttpRequest.php
+++ b/php-ga/src/GoogleAnalytics/Internals/Request/HttpRequest.php
@@ -121,10 +121,10 @@ abstract class HttpRequest {
                $usePost = strlen($queryString) > 2036;

                if(!$usePost) {
-                       $r = 'GET ' . $this->config->getEndpointPath() . '?' . $queryString . ' HTTP/1.0' . "\r\n";
+                       $r = 'GET ' . "http://" . $this->config->getEndpointHost() . $this->config->getEndpointPath() . '?' . $queryString . ' HTTP/1.0' . "\r\n";
                } else {
                        // FIXME: The "/p" shouldn't be hardcoded here, instead we need a GET and a POST endpoint...
-                       $r = 'POST /p' . $this->config->getEndpointPath() . ' HTTP/1.0' . "\r\n";
+                       $r = 'POST ' . "http://" . $this->config->getEndpointHost() . "/p" . $this->config->getEndpointPath() . ' HTTP/1.0' . "\r\n";
                }
                $r .= 'Host: ' . $this->config->getEndpointHost() . "\r\n";

@@ -180,7 +180,14 @@ abstract class HttpRequest {
                if($this->config->getEndpointHost() !== null) {
                        $timeout = $this->config->getRequestTimeout();

-                       $socket = fsockopen($this->config->getEndpointHost(), 80, $errno, $errstr, $timeout);
+                       $proxy = $this->config->getHttpProxy();
+                       if ($proxy) {
+                               list($host, $port) = explode(':', $proxy);
+                       } else  {
+                               $host = $this->config->getEndpointHost();
+                               $port = 80;
+                       }
+                       $socket = fsockopen($host, $port, $errno, $errstr, $timeout);
                        if(!$socket) return false;

                        if($this->config->getFireAndForget()) {

active visitors

Hi

active visitors increase with each call to autoload.php.
Is this something that need to be corrected server side?

Not track, when pagePath is not '/page.html'

Hi. I get some bug.. I get script, set all params and start track well. All visitors count by them. By if I change default line
$page = new GoogleAnalytics\Page("/page.html");

to something, like
$page = new GoogleAnalytics\Page("/page2.html");

All page count will stop. I trace all params and all be work well — to GA send param '/page2.html'. But on online page i dont see all new visitors
2014-03-18 19-35-42

On screenshot example of this moment.

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.