Giter VIP home page Giter VIP logo

laravel-mixpanel's Introduction

laravel-mixpanel

In config.php add Timothylhuillier\LaravelMixpanel\LaravelMixpanelServiceProvider in the provider list and 'LaravelMixpanel' => 'Timothylhuillier\LaravelMixpanel\Facades\LaravelMixpanel' in aliases.

Then in terminal : php artisan config:publish timothylhuillier/laravel-mixpanel and add your token in app/config/package/timothylhuillier/laravel-mixpanel/config.php

In the config package the regex 'userAgent' => '^Mozilla((?!bot).)*$' skips all bot.


Now, to use this package, there is 2 solutions :

  • You can use 'LaravelMixpanel::', ie. LaravelMixpanel::track('Homepage View', ['connected' => false])

But with this solution, mixpanel people is unavailable. Then, I created getInstance().

  • The second solution is to use $mixpanel = LaravelMixpanel::getInstance();

For example :

<?php
$mixpanel = LaravelMixpanel::getInstance();
// identifie l'user
$mixpanel->identify($user->mixpanel_id);
// track l'event
$mixpanel->track("Upgraded account");

// MAJ de l'user dans la BDD de mixpanel
$mixpanel->people->set($user->mixpanel_id, array(
    '$name'       => $user->name,
    '$phone'      => $user->tel,
    '$address'    => $user->address,
    '$lat'        => $user->lat,
    '$lng'        => $user->lng,
));

laravel-mixpanel's People

Contributors

millar avatar nek- avatar timothylhuillier avatar valanz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

laravel-mixpanel's Issues

Config's not working

The line $this->package('timothylhuillier/laravel-mixpanel'); in LaravelMixpanelServiceProvider should apparently be inside of the register() function, instead of boot().

Can you have a look at this and push the fixed version to Packagist?

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.