Download the PHP package arcticfalcon/laravel-analytics without Composer

On this page you can find all versions of the php package arcticfalcon/laravel-analytics. 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 laravel-analytics

Analytics tracking package for Laravel 4.x

Latest Stable Version Latest Unstable Version License Total Downloads

Installation

Add to your composer.json following lines

"require": {
    "arcticfalcon/laravel-analytics": "~1.0"
}

Run php artisan config:publish arcticfalcon/laravel-analytics

Then edit analytics.php in app/config/packages/arcticfalcon/laravel-analytics to your needs.

Add 'ArcticFalcon\LaravelAnalytics\AnalyticsServiceProvider', to providers in app/config/app.php.

Add 'Analytics' => 'ArcticFalcon\LaravelAnalytics\AnalyticsFacade', to aliases in app/config/app.php.

Configuration

provider    - Provider to use, possible Providers are: GoogleAnalytics, NoAnalytics

Google Analytics

tracking_id - Tracking ID

tracking_domain - Tracking domain, unset or set to "auto" for automatic fallback

anonymize_ip - (true|false) anonymize users ip

auto_track - (true|false) auto tracking current pageview

Usage

In controller action (or anywhere else) use following statement to track an event or page view:

//  tracking the current page view
Analytics::trackPage(); // only necessary if `auto_track` is false or Analytics::disableAutoTracking() was called before

//  tracking an event
Analytics::trackEvent('category', 'action');

//  tracking a custom line
Analytics::trackCustom("ga('send', ......"); // this line will be added within the tracking script

In your view or layout template (e.g. a blade template) use the following statement:

{{ Analytics::render() }}

For Google Analytics you should place the statement right behind the body tag

<body>{{ Analytics::render() }}

How to use

The GoogleAnalytics Provider automatically controls the local environment behaviour for testing purposes. See https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced#localhost for details.

There is a builtin provider called NoAnalytics. This is for testing environments and tracks nothing. So you do not have to rewrite your code, simple select this provider in analytics configuration for your special environment configurations.

Track a measurement without having javascript

  1. Log in to Google Analytics and create custom definition. There you create a custom metrics. For example: Email opens, Integer type, min: 0 and max: 1 This will be available as metric1.

  2. Within your mail template (or page template) you have to create a tracking image

    <img src="{{ Analytics::trackMeasurementUrl('metric1', '1', new Event, new Campaign, md5($user)) }}" width="1" height="1" style="background-color: transparent; border: 0 none;" />

  3. That's it

API Documentation

For the correct usage methods look at the ArcticFalcon\LaravelAnalytics\Contracts\AnalyticsProviderInterface.php

Analytics::render()

For rendering the correct javascript code.

/**
 * returns the javascript code for embedding the analytics stuff
 *
 * @return string
 */
public function render();

Analytics::trackPage()

For tracking a page view.

/**
 * track an page view
 *
 * @param null|string $page
 * @param null|string $title
 * @param null|string $hittype
 * @return void
 */
public function trackPage($page, $title, $hittype);

Analytics::trackEvent()

For tracking an event

/**
 * track an event
 *
 * @param string $category
 * @param string $action
 * @param null|string $label
 * @param null|int $value
 * @return void
 */
public function trackEvent($category, $action, $label, $value);

Analytics::trackCustom()

For tracking a custom script line within the embedded analytics code.

/**
 * track any custom code
 *
 * @param string $customCode
 * @return void
 */
public function trackCustom($customCode);

Analytics::enableAutoTracking()

Enabling the auto tracking, overriding the configuration setting auto_track.

/**
 * enable auto tracking
 *
 * @return void
 */
public function enableAutoTracking();

Analytics::disableAutoTracking()

Disabling the auto tracking, overriding the configuration setting auto_track.

/**
 * disable auto tracking
 *
 * @return void
 */
public function disableAutoTracking();

Analytics::trackMeasurementUrl()

Sometimes you have to track measurements, e.g. opening an email newsletter. There you have no javascript at all.

/**
 * assembles an url for tracking measurement without javascript
 *
 * e.g. for tracking email open events within a newsletter
 *
 * @param string $metricName
 * @param mixed $metricValue
 * @param \ArcticFalcon\LaravelAnalytics\Data\Event $event
 * @param \ArcticFalcon\LaravelAnalytics\Data\Campaign $campaign
 * @param string|null $clientId
 * @param array $params
 * @return string
 */
public function trackMeasurementUrl($metricName, $metricValue, Event $event, Campaign $campaign, $clientId = null, array $params = array());

All versions of laravel-analytics with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version ~4.0
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 arcticfalcon/laravel-analytics contains the following files

Loading the files please wait ....