Git Product home page Git Product logo

Comments (11)

etienne-martin avatar etienne-martin commented on May 23, 2024

This is currently not possible. Can you show me a snippet of code that demonstrates how it's done with matomo?

from device-detector-js.

whimsicaldreamer avatar whimsicaldreamer commented on May 23, 2024

Here is how I do it with matomo:

DeviceDetector.php

<?php

namespace UAParserService\DeviceDetector;

use DeviceDetector\Parser\Client\ClientParserAbstract;

class DeviceDetector extends \DeviceDetector\DeviceDetector
{
    /**
     * @param ClientParserAbstract|string $parser
     */
    public function addClientParser($parser)
    {
        parent::addClientParser($parser);

        $item = array_pop($this->clientParsers);
        array_unshift($this->clientParsers, $item);
    }
}

MyAppParser

<?php

namespace UAParserService\DeviceDetector\Parser\Client;

use DeviceDetector\Parser\Client\ClientParserAbstract;

class MyAppParser extends ClientParserAbstract
{
    protected $fixtureFile = "my_app.yml";
    protected $parserName  = "mobile app";

    /**
     * @return string
     */
    protected function getRegexesDirectory()
    {
        return dirname(__FILE__);
    }
}

my_app.yml

# MyApp
- regex: 'MyApp(?:[ /]([\d\.]+))?'
  name: 'MyApp'
  version: '$1'

Sample custom UA
MyApp/1.0.0 (Linux; Android 9; ONEPLUS A6010)

Follow this link, to get the snippet for adding custom bots.

from device-detector-js.

whimsicaldreamer avatar whimsicaldreamer commented on May 23, 2024

@etienne-martin any thoughts about it?

from device-detector-js.

etienne-martin avatar etienne-martin commented on May 23, 2024

I'm pretty busy this week, I'll get back to you as soon as possible.

from device-detector-js.

whimsicaldreamer avatar whimsicaldreamer commented on May 23, 2024

No issues. I will wait for it.

from device-detector-js.

whimsicaldreamer avatar whimsicaldreamer commented on May 23, 2024

Any updates to this feature?

from device-detector-js.

etienne-martin avatar etienne-martin commented on May 23, 2024

I took glance at it and it doesn't seem to be easily achievable with the current state of the lib.

from device-detector-js.

whimsicaldreamer avatar whimsicaldreamer commented on May 23, 2024

Any thoughts on how it might be possible?

from device-detector-js.

etienne-martin avatar etienne-martin commented on May 23, 2024

I honestly don't know how I would implement such feature.

from device-detector-js.

whimsicaldreamer avatar whimsicaldreamer commented on May 23, 2024

Any way of extending the classes?

from device-detector-js.

etienne-martin avatar etienne-martin commented on May 23, 2024

This is not something I'm willing to spent time on, feel free to fork the repo.

from device-detector-js.

Related Issues (20)

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.