Giter Club home page Giter Club logo

laravel-ab's Issues

not working with Laravel 5.8?

New (empty) laravel project, tried to use your example code, and got error:

Call to a member function incrementVisitor() on null

No support for Laravel 5.8

I see in your composer.json that you specify that this package requires illuminate/support 5.5.* || 5.6.* || 5.7.* .

Is there a reason not to add 5.8.* as well?

Some issues you may encounter if you upgrade:

  1. You probably want to require orchestra/testbench 3.8.* as well
  2. php test will most likely fail unless you change the setUp method signature in TestCase.php to public function setUp(): void

N+1 queries while creating the experiments collection.

Thanks for the great package, Ben! I noticed N+1 queries:

Example: I created two experiments and two goals. If a user is visiting a page with an included a/b test the package fetches the experiment one, then separately the two goals. After that it fetches the second experiment and the two goals separately as well. Then, it is updating the visitors counter. So in the end 7 queries are performed.

The query problem is due to the nested foreach in the start() method in the ABTesting class. The goals model should be eager loaded.

It would be great if you have a quick solution for the problem. Otherwise I will create a PR in the next weeks.

Can't complete a goal

Hi,

I tried a couple of ways to complete a goal. I tried to put {{AbTesting::completeGoal('order-placed')}} inside the blade template that renders when a order is placed. I added the goal in the config file and placed an a/b experiment on my homepage. The ab_goals table does not show any data. The other thing that I tried is to call $test = (new AbTesting())->completeGoal('order-placed'); or AbTesting::completeGoal('order-placed'); inside the controller. Neither produce any results.

Multiple A/B Testing at once?

I think there are cases for many when we may want to run multiple experiment at once. For an instance, I may want to pick a font from an array and at the same time pick a different header logo. We can do something like this in ab-testing.php:


$experimentLists= '{

    "font": ["system-font","inter-font"],
    "home-welcome": ["home-welcomeMainTop","home-welcomeTopStories"]
}'; 
   return [ 'experiments' => json_decode($experimentLists)......... ] 

This way, it always pick one item for each array of an experimentLists object.

This would enhance this tool because there are no any other A/B testing tools with this feature.

Problem with lock

Database: Percona 8.0.15

Exception:
ErrorException: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction (SQL: update ab_experiments set visitors = visitors + 1, updated_at = 2019-04-09 15:11:48 where id = 1) (View: /var/www/resources/views/user/busca/busca.blade.php)

Support for Laravel 7.x

Looking forward to using your fantastic work in my application.

I'm running into an issue when trying with the latest Laravel 7.x

Problem 1
- Installation request for ben182/laravel-ab ^1.2 -> satisfiable by ben182/laravel-ab[1.2.0].
- Conclusion: remove laravel/framework v7.1.3
- Conclusion: don't install laravel/framework v7.1.3
- ben182/laravel-ab 1.2.0 requires illuminate/support 5.6.* | 5.7.* | 5.8.* | ^6.0 -> satisfiable by illuminate/support[5.6.x-dev, 5.7.17, 5.7.18, 5.7.19, 5.7.x-dev, 5.8.x-dev, 6.x-dev, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.16, v5.6.17, v5.6.19, v5.6.2, v5.6.20, v5.6.21, v5.6.22, v5.6.23, v5.6.24, v5.6.25, v5.6.26, v5.6.27, v5.6.28, v5.6.29, v5.6.3, v5.6.30, v5.6.31, v5.6.32, v5.6.33, v5.6.34, v5.6.35, v5.6.36, v5.6.37, v5.6.38, v5.6.39, v5.6.4, v5.6.5, v5.6.6, v5.6.7, v5.6.8, v5.6.9, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.18.1, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].
- don't install illuminate/support 5.6.x-dev|don't install laravel/framework v7.1.3
- Installation request for laravel/framework (locked at v7.1.3, required as ^7.0) -> satisfiable by laravel/framework[v7.1.3].

Installation failed, reverting ./composer.json to its original content.

[Feature Request] Disable pageView for bots and crawlers

Hey Ben!
First of all, thank you for your package! It's slim and seems to work great! Just started testing it on one of my sites.

However, I quickly found that a lot of bots and crawlers are skewing my stats.
I think it would be nice to have an option in the config to maybe (try to) ignore these page views.

Do you agree? I feel that I need to write it for myself, so might as well push it upstream to your repo.

Laravel 8 support

I'm getting the following error while trying to install it for Laravel 8.* project:

composer require ben182/laravel-ab
Using version ^2.0 for ben182/laravel-ab
./composer.json has been updated
Running composer update ben182/laravel-ab
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - ben182/laravel-ab[2.0.0, ..., 2.0.2] require illuminate/support ^6.0 | ^7.0 -> found illuminate/support[v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev] but these were not loaded, likely because it conflicts with another require.
    - Root composer.json requires ben182/laravel-ab ^2.0 -> satisfiable by ben182/laravel-ab[2.0.0, 2.0.1, 2.0.2].

Trying to get property 'name' of non-object when crawled

return $this->getExperiment()->name === $name;

When crawled by Google bot there is no session, so getExperiment() won't return an object with a name property. This will break the page and google will see a 500 while normal users have a 200.

Maybe:

public function isExperiment(string $name)
    {
        if ((new CrawlerDetect)->isCrawler()) {
            return false;
        }

        $this->pageView();

        return $this->getExperiment()->name === $name;
    }

No support for PHP 8

Trying to install for laravel 8 and I get the following output

▶ composer require ben182/laravel-ab

                                                                                                                            
  [InvalidArgumentException]                                                                                                
  Package ben182/laravel-ab has a PHP requirement incompatible with your PHP version, PHP extensions and Composer version:  
    - ben182/laravel-ab 1.2.0 requires php ^7.0 which does not match your installed version 8.0.8.    

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.