2017 © Pedro Peláez
 

library analytics-php

Barnebys Analytics - Simplified tracking

image

barnebys/analytics-php

Barnebys Analytics - Simplified tracking

  • Thursday, March 1, 2018
  • by barnebys
  • Repository
  • 1 Watchers
  • 2 Stars
  • 36 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 13 % Grown

The README.md

Latest Stable Version Build Status Coverage Status, (*1)

Barnebys Analytics

This is an helper for PHP to build tracking URL for Barnebys Analytics with ease., (*2)

Track clicks

// Create the URL Builder with your tracking domain & secret
$urlBuilder = new UrlBuilder('analytics.yourdomain.com', 'test');
$urlBuilder
    ->setProgramId(123)
    ->setKind('click')
    ->setURL('http://www.someurl.com/')
    ->setDimension1('a')
    ->setDimension2('b')
    ->setDimension3('c');
    ->setDimension4('d');
    ->setDimension3('e');

// Get the signed tracking URL
$url = $urlBuilder->createURL();

Track leads

$urlBuilder = new UrlBuilder('analytics.barnebys.sh', 'test');
$urlBuilder
    ->setProgramId(123)
    ...
    ->isAffiliate();

Impressions

Generate the URL from PHP and use a lazy loader that loads the tracking pixel when visible in the browser window. If you do not have a compatible lazy loader we recommend using this lazy loader which is written in vanilla js., (*3)

For most compatibility - place the script below before your </body> tag., (*4)

<script type="text/javascript">
    (function(w, d){
        var b = d.getElementsByTagName('body')[0];
        var s = d.createElement("script"); s.async = true;
        var v = !("IntersectionObserver" in w) ? "8.5.2" : "10.3.5";
        s.src = "https://cdnjs.cloudflare.com/ajax/libs/vanilla-lazyload/" + v + "/lazyload.min.js";
        w.lazyLoadOptions = {
            threshold: 0
        };
        b.appendChild(s);
    }(window, document));
</script>

Generating impression URL

// Create the URL Builder with your tracking domain & secret
$urlBuilder = new UrlBuilder('analytics.yourdomain.com', 'test');

// Create the impression passing on UrlBuilder, program id and optional dimensions 1-3
$impression = new Impression($urlBuilder, '123', 'a', 'b', 'c');

// Get the URL for the tracking pixel 
$url = $impression->getURL();

// Or by using the magic function toString
echo $impression;

// Or output image tag for lazy load
$impression->image();

The Versions

01/03 2018

dev-master

9999999-dev

Barnebys Analytics - Simplified tracking

  Sources   Download

MIT

The Development Requires

by Johan Johansson

analytics auctions barnebys

01/03 2018

v1.0.1

1.0.1.0

Barnebys Analytics - Simplified tracking

  Sources   Download

MIT

The Development Requires

by Johan Johansson

analytics auctions barnebys

01/03 2018

v1.0.0

1.0.0.0

Barnebys Analytics - Simplified tracking

  Sources   Download

MIT

The Development Requires

by Johan Johansson

analytics auctions barnebys

11/12 2017

v0.0.2

0.0.2.0

Barnebys Analytics - making tracking, leads and impression tracking simple.

  Sources   Download

MIT

The Development Requires

by Johan Johansson

analytics auctions barnebys

11/12 2017

0.0.1-beta.1

0.0.1.0-beta1

Barnebys Analytics - making tracking, leads and impression tracking simple.

  Sources   Download

MIT

The Development Requires

by Johan Johansson

analytics auctions barnebys