GithubHelp home page GithubHelp logo

isabella232 / piwik-java-tracker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from elsamuko/piwik-java-tracker

0.0 0.0 0.0 11.46 MB

Official Java implementation of the Piwik Tracking HTTP API.

License: BSD 3-Clause "New" or "Revised" License

Java 100.00%

piwik-java-tracker's Introduction

Piwik Java Tracker

Maven Central

Code Status

Build Status Coverage Status Average time to resolve an issue Percentage of issues still open

Official Java implementation of the Piwik Tracking HTTP API.

Javadoc

The Javadoc for this project is hosted as a Github page for this repo. The latest Javadoc can be found here. Javadoc for the latest and all releases can be found here.

Using this API

Create a Request

Each PiwikRequest represents an action the user has taken that you want tracked by your Piwik server. Create a PiwikRequest through

PiwikRequest request = new PiwikRequest(siteId, actionUrl);

The following parameters are also enabled by default:

required = true;
visitorId = random 16 character hex string;
randomValue = random 20 character hex string;
apiVersion = 1;
responseAsImage = false;

Overwrite these properties as desired.

Note that if you want to be able to track campaigns using Referrers > Campaigns, you must add the correct URL parameters to your actionUrl. For example,

URL actionUrl = new URL("http://example.org/landing.html?pk_campaign=Email-Nov2011&pk_kwd=LearnMore");

See Tracking Campaigns for more information.

All HTTP query parameters denoted on the Piwik Tracking HTTP API can be set using the appropriate getters and setters. See PiwikRequest.java for the mappings of the parameters to their corresponding Java getters/setters.

####Some parameters are dependent on the state of other parameters: EcommerceEnabled must be called before the following parameters are set: EcommerceId and EcommerceRevenue.

EcommerceId and EcommerceRevenue must be set before the following parameters are set: EcommerceDiscount, EcommerceItem, EcommerceLastOrderTimestamp, EcommerceShippingCost, EcommerceSubtotal, and EcommerceTax.

AuthToken must be set before the following parameters are set: VisitorCity, VisitorCountry, VisitorIp, VisitorLatitude, VisitorLongitude, and VisitorRegion.

Sending Requests

Create a PiwikTracker through

PiwikTracker tracker = new PiwikTracker(hostUrl);

where hostUrl is the url endpoint of the Piwik server. Usually in the format http://your-piwik-domain.tld/piwik.php.

To send a single request, call

HttpResponse response = tracker.sendRequest(request);

If you have multiple requests to wish to track, it may be more efficient to send them in a single HTTP call. To do this, send a bulk request. Place your requests in an Iterable data structure and call

HttpResponse response = tracker.sendBulkRequest(requests);

If some of the parameters that you've specified in the bulk request requre AuthToken to be set, this can also be set in the bulk request through

HttpResponse response = tracker.sendBulkRequest(requests, authToken);

Install

This project can be tested and built by calling

mvn package

The built jars and javadoc can be found in target

Test this project using

mvn test

This project also supports Pitest mutation testing. This report can be generated by calling

mvn org.pitest:pitest-maven:mutationCoverage

and will produce an html report at target/pit-reports/YYYYMMDDHHMI

Clean this project using

mvn clean

Contribute

Have a fantastic feature idea? Spot a bug? We would absolutely love for you to contribute to this project! Please feel free to:

  • Fork this project
  • Create a feature branch from the dev branch
  • Write awesome code that does awesome things
  • Write awesome test that test your awesome code
  • Verify that everything is working as it should by running mvn test. If everything passes, you may want to make sure that your tests are covering everything you think they are! Run mvn org.pitest:pitest-maven:mutationCoverage to find out!
  • Commit this code to your repository
  • Submit a pull request from your branch to our dev branch and let us know why you made the changes you did
  • We'll take a look at your request and work to get it integrated with the repo!

Contact

[email protected]

License

This software is released under the BSD 3-Clause license. See LICENSE.

Copyright (c) 2015 General Electric Company. All rights reserved.

piwik-java-tracker's People

Contributors

bcsorba avatar elsamuko avatar pkraeutli avatar tholu avatar udf2457 avatar vdriet avatar

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.