Download the PHP package webiny/analytics-db without Composer

On this page you can find all versions of the php package webiny/analytics-db. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package analytics-db

AnalyticsDb

AnalyticsDb is a component that enables you to store and query different time-series (numerical) data. Simple use-case would be tracking the number of visitors for your website inside the given date/time range, or tracking ecommerce revenue for a given quarter.

Dependencies

The component requires an instance of \Webiny\Component\Mongo\Mongo to access your Mongo database where it will create several collections to store the data.

Dimensions

Dimensions track different data which is still tied to your entity. For example say you have a product A, in 2 colors, red and blue. The product would be your entity, and colors would be your dimensions.

When tracking the dimensions, you can then get stats like "show me the views on all red version of my product".

Attributes

Attributes are much simpler than dimensions. Attributes are just additional tags you can attach to an entity so you can group, sort and filter by them. A typical use-case for attributes is say you have a product, which has a certain brand and you want to be able to get a list of top 10 products for a certain brand.

You can add multiple attributes to a product.

Now you can do something like this:

Storing data

The data is stored using the log method. Note that data is not actually saved until you call the save method.

To assign attributes to your data, for example you wish to increment the number of visitors on your site, but you also want
to store some attributes, like what browser the user used, and from which country he came from; for that you can use dimensions. Dimensions are also counters which can be queried.

For example, for this use case:

You can know how many visitors you had for a given date range, and you can group that result either by day, or by month. Since you stored some data in dimensions, you can also know, how many users used chrome vs, for example firefox or ie, and then you can cross reference that to the total number of your visitors.

You can also assign a referral value to the log, for example, you can track per-page analytics like so:

This will track a visitor for page with the id of 123. And then later you can query the analytics data for that page.

Some best practice is not to query data with a large set of different referrals. For example if you want to know how many visitors in total you had on your website, don't query and then sum the number of visitors of all your pages. Instead store 2 different analytics data, one for pages, and one for visitors in general.

By default the log method will increment the value by 1, but in some cases, for example when you wish to track revenue, you want to specify the increment value, and this is done by using the 3rd parameter, like so:

This will increase the revenue counter by 120.00 (float value is supported).

Querying data

To query the data, you need to get an instance of the query, like so:

For the query you have to specify the entity name, referral, and the date range. There is a DateHelper class to help you in regards to some commonly used date ranges, but you can also specify your own custom range, it is just an array with two unix timestamps [dateFromTimestamp, dateToTimestamp].

Once you have the query instance, you can get the results for the given range. By default the data is grouped by day, but you can also get it in a per-month format.

To query dimensions, use the dimension method, like so:

License and Contributions

Contributing > Feel free to send PRs.

License > MIT

Resources

To run unit tests, you need to use the following command:


All versions of analytics-db with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
webiny/mongo Version ~1.6 || dev-master
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package webiny/analytics-db contains the following files

Loading the files please wait ....