Code Monkey home page Code Monkey logo

php-gacx's People

Contributors

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-gacx's Issues

__utmx cookie is never set

use UnitedPrototype\GoogleAnalytics;
$experiment = new GoogleAnalytics\Experiment('xxxxxxxxxxxxxxxxxx');
$variation = $experiment->chooseVariation();

everytime I get different variations, the reason is that $_COOKIE['__utmx'] is unset...
@thomasbachem do you know why? do I have to add more code apart from these 3 lines?? Thanks

Cookies not set when port is used in URL

My CI test webserver is on port 8000 so my tests continually failed but only on this server. The reason is that Firefox doesn't set cookies when there is a port in the domain. I'm not sure what other browsers could be affected.

I didn't want to fork for this simple fix but here it is for Experiments.php (notice the addition of a parse_url call when using $_SERVER):

    /**
     * @return string
     */
    public static function getDomainName() {
        if(static::$domainName == 'auto') {
            return isset($_SERVER['HTTP_HOST']) ? parse_url(strtolower($_SERVER['HTTP_HOST']), PHP_URL_HOST) : null;
        } elseif(static::$domainName) {
            return static::$domainName;
        } else {
            throw new UnexpectedValueException('Unable to determine domain name, please provide one via setDomainName()!');
        }
    }

GA Exp. javascript code

Hi,

Basically it's just a question... Do we need to insert the official Google Analytics Content Experiment javascript code (which is provided when you create a new Experiment in GA) in the view as well? Is that necessary too? Or if I use your code is that enough to send the variation data back to GA?

Thanks!

Composer update dont work

I need to run composer update at my hosting so I log in with ssh and try to run comand:

composer update

inside /www folder where I have laravel and composer instalation

but I get error: http://i.stack.imgur.com/FGC01.png

in contact with my hosting provider they tell me to run command:

php -d memory_limit=512M composer update

I run this command but I get: "Could not open file: composer"

What to do? What is the soluton here?

Warning! Will throw fatal error if experiments ends

This caught me off guard in the early hours of this morning, 4 hours of downtime because this library throws a fatal error when the experiment ends and can't be found. Recommended fix is wrapping calls in try/catch

try {
    $experiment = new GoogleAnalytics\Experiment('xxxx');
    $variation = $experiment->chooseVariation();
} catch(Exception $e) {
   $variation = 1;
}

Conversions are lost

I tried to use php-gacx to perform GA content experiments on the server-side.

But it seems to lose the majority of the conversions that happen on the site (the experiments page doesn't show all the conversions that GA does).

At the same time, the engine for choosing the experiment variation works fine. It shows different versions of the page in different browsers, so that works just fine.

Here is the code:

<?php
include('php-gacx/autoload.php');
use UnitedPrototype\GoogleAnalytics;
$experiment = new GoogleAnalytics\Experiment('xxxxxxxxxxx');
$variation = $experiment->chooseVariation();
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

          ga('create', 'UA-xxxxxx-x', 'auto');
          ga('send', 'pageview');

        </script>
<script>
        window.gaData = {
            expId:  '<?= $experiment->getId(); ?>',
            expVar: '<?= $experiment->getChosenVariation(); ?>'
        };
        </script>
<!-- the rest of the page -->

Would really appreciaty any comments / suggestions.

Composer

HI @thomasbachem! Do you think you'd be able to add a composer.json, tag a new version with the latest changes and publish to packagist.org?

Thanks!

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.