Coder Social home page Coder Social logo

matomo-org / matomo-sdk-android Goto Github PK

View Code? Open in Web Editor NEW
384.0 46.0 162.0 5.83 MB

SDK for Android to measure your apps with Matomo. Works on Android phones, tablets, Fire TV sticks, and more!

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

Java 96.75% Kotlin 3.25%
piwik-sdk analytics android-sdk java metrics android piwik tracker matomo matomo-sdk

matomo-sdk-android's Introduction

Matomo SDK for Android

Build Codecov

Welcome to the Matomo Tracking SDK for Android. This library helps you send analytics data from Android apps to Matomo instances. Until v4 this library was known as Piwik Tracking SDK for Android.

Features:

Quickstart

For the not so quick start, see here or look at our demo app

  • Setup Matomo on your server.
  • Include the library in your app modules build.gradle file via JitPack
repositories {
  maven { url 'https://jitpack.io' }
}
dependencies {
  implementation 'com.github.matomo-org:matomo-sdk-android:<latest-version>'
}
  • Now you need to initialize your Tracker. It's recommended to store it as singleton. You can extend MatomoApplication or create and store a Tracker instance yourself:
import org.matomo.sdk.TrackerBuilder;

public class YourApplication extends Application {
    private Tracker tracker;
    public synchronized Tracker getTracker() {
        if (tracker == null){
            tracker = TrackerBuilder.createDefault("http://domain.tld/matomo.php", 1).build(Matomo.getInstance(this));
        }
        return tracker;
    }
}
  • The TrackHelper class is the easiest way to submit events to your tracker:
// The `Tracker` instance from the previous step
Tracker tracker = ((MatomoApplication) getApplication()).getTracker();
// Track a screen view
TrackHelper.track().screen("/activity_main/activity_settings").title("Settings").with(tracker);
// Monitor your app installs
TrackHelper.track().download().with(tracker);
  • Something not working? Check here.

License

Android SDK for Matomo is released under the BSD-3 Clause license, see LICENSE.

matomo-sdk-android's People

Contributors

alex0709 avatar d4rken avatar dependabot[bot] avatar dotsbb avatar eldk avatar fabiotacke avatar friederbluemle avatar hannesa2 avatar kevinslashslash avatar koen20 avatar lorenc-tomasz avatar mohand1993 avatar moopat avatar nasoym avatar starker3 avatar tolriq avatar tsteur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

matomo-sdk-android's Issues

Offline mode missing

If the dispach of events occurs when the device is offline, the events queue is cleared before knowing if the request was a success.

Use Okhttp instead of HTTPUrlConnection

A thing that bugged me was the try catch I needed when instantiating the tracker for a URL that I know to be good since I own the server. Then I started to refactor that in the end I ended up with a replacing HTTPUrlConnection with Okhttp. Would you be interested in something like that.

License the Android SDK under Simplified BSD license

The goal of this issue is to release the Android SDK under the Simplified BSD license.

I've added the license file to git in
70675c6

Next steps:

  • Add License section in README mentioning license
  • Edit source files and add a code header:
/**
 * Android SDK for Piwik
 *
 * @link https://github.com/piwik/piwik-android-sdk
 * @license https://github.com/piwik/piwik-sdk-android/blob/master/LICENSE BSD-3 Clause
 */

Proposal: Remove compiled jar from repo, attach to tagged releases

Currently the repo contains the compiled jar here:
https://github.com/piwik/piwik-sdk-android/tree/master/piwik_sdk/jar
It's difficult to track against which code version it was built and everytime you make a testbuild it gets changed and suggested to be recommitted by git.
Additionally it's quickly outdated and we don't want (do we?) have to build and update it with each PR.
(Currently the jar doesn't already match the latest code).

I would suggest to remove the jar from the repo and attach it to each release as download:
https://github.com/piwik/piwik-sdk-android/releases

@dotsbb or @mattab could then choose certain commits, tag it and create a new release.

Merge develop into master.

@dotsbb I think we can merge the current develop branch into master.
I've been using it in production for a month now and I'm satisfied.

New people looking to integrate Piwik into their app shouldn't use the build from current master branch.

We could increase the version to 0.0.2 as there were some major changes.

When merging we should also make sure the .jar file is either updated or removed to prevent confusion.

Not sure whats going on with #31

Setting connection timeout

I'm trying to change connection timeout from 5 to 10 seconds. My server is not very stable at the moment. I tried mPiwikTracker.getDispatcher().setTimeOut(10000); in try block below but getDispatcher() has protected access. My first question - why? And the second: how do it properly?

I post some code from the class extending Application class to make it easier. This is how I get the tracker.

public synchronized Tracker getTracker() {
        if (mPiwikTracker != null)
            return mPiwikTracker;

        try {
            mPiwikTracker = Piwik.getInstance(this).newTracker("http://indywidualni.org/analytics/piwik.php", 1);
            mPiwikTracker.setUserId(Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID));
            mPiwikTracker.setDispatchInterval(-1);
        } catch (MalformedURLException e) {
            Log.w("Piwik", "url is malformed", e);
            return null;
        }

        return mPiwikTracker;
    }

And a piece from onCreate

getTracker().trackAppDownload();
getTracker().dispatch();

Documentation to install and use the Android SDK for Piwik in your app

The goal of this issue is to provide users of the SDK a useful Readme file and documentation.

Here is some inspiration for the guide:

The documentation can be put in the Readme.md file so it is accessible at first page load for all users. Having an easy to read guide will greatly help the adoption of our SDK, and make Android developers happy!

This is the last step before we can publicly announce the SDK to the community matomo-org/matomo#4733

Problems tracking pages and visitors

0
down vote
favorite
I'm having a problem using the Piwik Android API and was wondering if one of you would be able to help me.

I used the javascript API to track one web site previously and had no problems at all. Using the Piwik console I was able to see the visited pages count normally.

Lately I had to do the same thing using the Android API. In my code, I used the Trackers like this: TrackHelper.track().screen("myScreenl").with(((MyApplication) getApplication()).getTracker());

In my console when I add the 'real time visitors widget' I can see the latest accesses by visitors and the corresponding pages (as the attached pic shows) .

screenhunter_03 aug 29 16 10

But I can't keep track of visited pages. When I try to use widgets like 'Event Actions' or 'Pages' it only shows 'There's no data for this report.'. It should show something like: pages -> myScreen1: 10 hits.

image

Am I doing something wrong?

thanks in advance.

Proposal: Switch to a master/dev branch setup

Currently all changes and PR are merged into the master branch.
I suggest we create a dev branch.
All changes and PR are done on the dev branch.
At certain points someone says "time for a new release":

  • Merge the dev branch into master
  • Tag the last commit in master after the merge
  • Create a new release for this tag, build the jar, attach it.
  • Increase the version code+name in the sdk gradle file on the dev branch (i.e. new version in the making)

At this point the cycle starts from the beginning.

What do you think @dotsbb ?

TODO:

  • Create new branch
  • Update docs to describe this
  • Possibly update travis-ci to do it's magic on the dev branch? Not sure still inexperienced with travis

Supporting more than 5 Custom Variables

It is possible to configure Piwik to receive more than 5 cvars (http://piwik.org/faq/how-to/faq_17931/).

CustomVariables.java is currently hard-coded to support 5 CVars. Should we instead make it configurable?

    private static final int MAX_VARIABLES = 5;
    protected static final int MAX_LENGTH = 200;

    public CustomVariables() {
        super(MAX_VARIABLES);
    }

User visits do not seem to be tracked properly.

We are registering visits from an Android application. When viewing from the dashboard visits and unique visitors are accurately reflected, however, when calling API method VisitsSummary.getUsers and providing parameter &segment=visitorType==returning the value returned is always zero. The user visits all register as new users even though the users have multiple visits across several days.

Website visits reported via the javascript client do report new vs. returning visitors. Both Javascript and Java clients are sending the userid via the uid paramater.

Idea: When tracking an app download fill thereferrer field with the installer packagename

So in one of my last PRs #40 i introduced a method to track downloads with either the checksum or the installer packagename as as extra identifier.

What about additionally filling the referrer field (only on the trackdownload query) with the value from getInstallerPackagename.
While it's not a referrer in the same way websites have it, it would make the referrer display in Piwik useful for mobile apps.

@dotsbb What do you think?

Note: You still have to prepend everything that you want to send in the referrer field with "http://" otherwise Piwik won't take it. @mattab Should i make a ticket for that? Or do you append it somewhere, you have the better ticket overview ;)

Add SNI support

Hi, when I test on my piwik sever, I met error like below:
javax.net.ssl.SSLException: hostname in certificate didn't match: analytics.test.com != test

Unable to connect local piwik

i implement default method of demo application in my android app and use TrackHelper for sending request to local piwik , but when i see network logs i can't see my request despite when use getTracker().getAPIUrl().toString() see the correct path .

here is my sample code :

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/IRANSansMobile_Bold.ttf")
            .setFontAttrId(R.attr.fontPath)
            .build()
    );

    TrackHelper.track().screen("/").title("First Activity").with(getTracker());

    Toast.makeText(MainActivity.this, getTracker().getAPIUrl().toString() , Toast.LENGTH_SHORT).show();

    TextView tv = (TextView)findViewById(R.id.first);
    tv.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(MainActivity.this, SecondActivity.class);
            startActivity(intent);
        }
    });



}

private Tracker getTracker() {
    return ((PiwikApplication) getApplication()).getTracker();
}

Piwik for Android SDK - Battery Usage

Hi there,

As per this thread I am posting here

https://forum.piwik.org/t/piwik-for-android-sdk-battery-usage/18623

We've looked at this a bit more and it looks like Piwik does do dispatching, every 2 minutes we think. However the question still stands regarding battery usage and addressing the points in this article which seems to indicate app tracking is very difficult.

http://www.lunametrics.com/blog/2015/09/24/5-considerations-google-tag-manager-mobile-apps/

Also if it uses dispatching is it impossible to gather all hits or is that a Google Play Services issue and Piwik doesn't use that.

Thanks for any feedback.

Support Content Tracking

This will be a new feature in Piwik 2.7.0 see matomo-org/matomo#4996 .

In PHP Tracker there are two new methods see https://github.com/piwik/piwik/blob/master/libs/PiwikTracker/PiwikTracker.php#L556-L583

doTrackContentImpression($contentName, $contentPiece = 'Unknown', $contentTarget = false)

It maps to the three parameters c_n, c_p and c_t see https://github.com/piwik/piwik/blob/master/libs/PiwikTracker/PiwikTracker.php#L894-L911

and

doTrackContentInteraction($interaction, $contentName, $contentPiece = 'Unknown', $contentTarget = false)

Which sends to the four parameters c_i, c_n, c_p and c_t see https://github.com/piwik/piwik/blob/master/libs/PiwikTracker/PiwikTracker.php#L914-L948

Content piece (c_p) and target (c_t) are both optional and should be only sent if a value is set. Content piece defaults to "Unknown" in the PHP implementation but a user could pass the boolean value false to not send any value or content piece.

Do you need more information?

Why track Exception with Piwik?

I'm looking for a use case or legitimization why we should track and forward exceptions.
Is there a plugin for the service tracker that visualizes them well and allows for organization?
Or to prevent reports from older apps for solved issue?

In bigger apps with 100k+ users, you always have crashs that are out of your control and after a few weeks the "Crash Event" list would be filled with useless stuff and no way to hide or remove these except manual database alternation. I do not see this being useful except maybe to have screenview tracking like start->screen1->screen2->crash. Although this is cool, with bigger usernumbers, i can't see this being favorable over traditional crash tracking (ACRA, Crashlytics etc.).

At least least this should be opt-in, not on by default.
But maybe this can be removed and we don't have to maintain it.

API 10 - https PIWIK server - Could not validate certificate signature -

Hello,

Using API 19, and one PIWIK Server 2.16.5 (NGINX, SSL, letsencrypt) the events are sent.

10-15 02:07:59.053 14043 14043 D PIWIK:Tracker: URL added to the queue: ?_idvc=3&apiv=1&uid=f7a5aec6-b13a-4959-a2e7-a0f3a9bbbe2c&res=720x1280&idsite=1&send_image=0&cdt=2016-10-15%2002%3A07%3A59%2B0200&_viewts=1476466722&lang=fr&url=http%3A%2F%2Ftld.domain.app%2FMainActivity&country=FR&rec=1&_id=71c0ecc76bb5472e&new_visit=1&action_name=MainActivity&ua=Dalvik%2F1.6.0%20%28Linux%3B%20U%3B%20Android%204.4.2%3B%20HTC%20One%20mini%20Build%2FKOT49H%29&_idts=1476466274&rand=76399
10-15 02:09:59.051 14043 14073 D PIWIK:Dispatcher: Drained 1 events.
10-15 02:10:00.713 14043 14073 D PIWIK:Dispatcher: status code 204
10-15 02:10:00.713 14043 14073 D PIWIK:Dispatcher: Dispatched 1 events.

With the same server and app, API 10 device throw this exception :

10-15 01:43:47.929 21711 21711 D PIWIK:Tracker: URL added to the queue: ?_idvc=6&apiv=1&uid=a63502e7-3bc5-49c2-adc5-e9c0069584e1&res=320x480&idsite=1&send_image=0&cdt=2016->10-15%2001%3A43%3A47%2B0200&_viewts=1476474566&lang=fr&url=http%3A%2F%2Ftld.domain.app%2FMainActivity&country=FR&rec=1&_id=af628cf6c51147fb&new_visit=1&action_name=MainActivity&ua=Dalvik%2F1.4.0%20%28Linux%3B%20U%3B%20Android%202.3.6%3B%20XT320%20Build%2FGRK39F%29&_idts=1476464424&rand=90454
10-15 01:45:47.959 21711 21726 D PIWIK:Dispatcher: Drained 1 events.
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: Cannot send request

10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: javax.net.ssl.SSLHandshakeException: org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate signature.

10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:477)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:328)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.setupSecureSocket(HttpConnection.java:185)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:433)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionImpl$HttpsEngine.makeConnection(HttpsURLConnectionImpl.java:378)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.retrieveResponse(HttpURLConnectionImpl.java:1018)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:726)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:121)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.piwik.sdk.dispatcher.Dispatcher.dispatch(Dispatcher.java:219)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.piwik.sdk.dispatcher.Dispatcher$1.run(Dispatcher.java:165)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at java.lang.Thread.run(Thread.java:1019)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: Caused by: java.security.cert.CertificateException: org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate signature.
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:161)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:664)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:474)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: ... 10 more
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: Caused by: org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate signature.
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCertA(RFC3280CertPathUtilities.java:1504)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:399)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at java.security.cert.CertPathValidator.validate(CertPathValidator.java:197)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:156)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: ... 13 more
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: Caused by: java.security.SignatureException: Signature was not verified
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.apache.harmony.security.provider.cert.X509CertImpl.verify(X509CertImpl.java:522)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.bouncycastle.jce.provider.CertPathValidatorUtilities.verifyX509Certificate(CertPathValidatorUtilities.java:1551)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: at org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCertA(RFC3280CertPathUtilities.java:1496)
10-15 01:45:48.239 21711 21726 W PIWIK:Dispatcher: ... 16 more
10-15 01:45:48.239 21711 21726 D PIWIK:Dispatcher: Dispatched 0 events.

have you any clue ?

Thanks,
Eric

Screen capture from info on Certificate when browsing PIWIK SSL server index page with API 10 device (https://community.letsencrypt.org/t/which-browsers-and-operating-systems-support-lets-encrypt/4394):

screen

From https://www.ssllabs.com/ssltest/analyze.html on PIWIK SERVER

Android 2.3.7 No SNI (2) RSA 4096 (SHA256) TLS 1.0 TLS_DHE_RSA_WITH_AES_128_CBC_SHA DH 2048 FS
(2) No support for virtual SSL hosting (SNI). Connects to the default site if the server uses SNI.

Run the automated test continuously on Travis CI

The goal of this issue is to run the tests continuously, using Travis CI. This will provide quick feedback to developers and pull requests authors about their work.

Tasks

  • Setup Travis CI builds to run all tests,
  • Make the build green on Travis,
  • Add the build status badge to the README.

Failed to resolve: org.piwik.sdk:piwik-sdk:0.0.3

Hi,

I added the sdk to my project dependences (build.gradle)

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    ...
    compile 'org.piwik.sdk:piwik-sdk:0.0.3'
}

When I sync the project, I get this error :
image

Am I doing something wrong?

piwik-sdk inside project

hi guys' sorry but i am new on java development, may i ask how to include piwik-sdk inside a project not getting from github or maven? thanks in advance :)

i am using android studio for my platform.

UserID is neither unique nor persisted nor automatically generated by the SDK.

The documentation says:

If no user ID is used, the SDK will generate, manage and persist a random id for you.

Currently the SDK does not generate a userID. it just takes the empty userID field.
There is a getUserId method that generates something but it's only in the demo activity and the ID isn't unique either.
I propose to use the UUID class to create a random UUID, persist it in shared preferences and use that.

Does anyone disagree? I will make a pull request when my current ones have been processed.

Can't compile with version 1.0.0

The following error occurs when I add 'compile 'org.piwik.sdk:piwik-sdk:1.0.0' to the dependencies.

Error:Failed to resolve: com.jakewharton.timber:timber:4.1.3-20160408.041006-2

Proposal: Get rid of Piwik/Tracker differentation

I see no need for the Piwik AND Tracker class except to be able to have multiple Trackers for thread safety.
What if we make the Tracker abstract & threadsafe.
e.g.

class MyTracker extends PiwikTracker {
    @Override
    public String getTrackerUrl() {
        return "foo";
    }
}

Then in your code you just call MyTracker.get(getContext()).doStuff()

  • The HashMap approach in Piwik.class already seems superfluos, see #23
  • Dry run / opt out can be set directly.
  • autoBindActivities is currently not working correctly anyways and can be moved into an extra class if we really want it, but then go along something like Tracker.bind(Activity), we could also look into Tracker.bind(Fragment)

Would love some comments on this.

Chaos in autoBindActivities

Currently onActivityStarted & onActivityResumed both end up calling activityStart(...), leading to 2 tracked screen views each time the activity starts (app starts / app rotation).

When onActivityPaused & onActivityStopped is called, they both call through to activityStop(...). In the same case as above we trying to dispatch two times directly after each other.
The documentation also states that stopAutoDispatching() would be called when the Activity is paused, but this is currently not happening.

I propose to change it like this:
onActivityStarted ->
onActivityResumed -> start autodispatching & track screen view
onActivityPaused -> stop auto dispatching
onActivityStopped -> dispatch remaining events
onActivityDestroyed ->

Cannot test it on a LocalHost

Hi,

I am trying to test the sample application. Running wamp as a server on my system and using it as a local host. Already have installed piwik on wamp. Created a website: http://demo.piwik.com
And used it in my application class as:
mPiwikTracker = getPiwik().newTracker("http://demo.piwik.com", 1);

Once application runs, I tap on different buttons in the demo app but the demo app doesnt record any clicks on against the local host.

What happens where there was no Internet connection and the app was closed?

I'm using Piwik to count unique app instalations. I was looking through the code and I couldn't find a very important thing.

What happens when the data cannot be dispatched and the user closes the app? Is the data somehow stored until next run in order to try to send it again later?

I wanted to use it as the reliable download counter but I cannot find serialization of not send data anywhere.

So please explain me what happens when the app is closed before the data is dispatched. Will the app try to send data again when it's run later? Or if dispatching fails and the app is terminated the data is just lost. It's very important to me.

I'm using a default dispatch interval (120s) so it's possible that the app gets closed before the first dispatcher run.

Concurrency issue when setting custom variables

Seems to be very rare, happened only a few times out of a few 10k events.
Writing this down so I don't forget it :).
Maybe fix this and do #69 at the same time?

java.util.ConcurrentModificationException
        at java.util.HashMap$HashIterator.nextEntry(HashMap.java:806)
        at java.util.HashMap$EntryIterator.next(HashMap.java:843)
        at java.util.HashMap$EntryIterator.next(HashMap.java:841)
        at org.json.JSONObject.<init>(JSONObject.java:128)
        at org.piwik.sdk.CustomVariables.toString(CustomVariables.java:90)
        at org.a.a.e.a(Tracker.java:16684)
        at eu.thedarken.sdm.tools.e.a.a(PiwikHelper.java:13159)
        at eu.thedarken.sdm.tools.piwik.PiwikHelper$1.run(PiwikHelper.java:305)
        at java.lang.Thread.run(Thread.java:841)

Improve non-javadoc documentation

We should move most of the documentation that is currently in the README.md to the GitHub wiki pages.

The readme should contain:

  • Repo info tags (coverage,version etc)
  • Small library description
  • Prerequesites (Piwik server instance)
  • How to add the library (gradle statement)
  • Small snippet of code showing basic screen tracking
  • Link to wiki page
  • License

Tracker.trackEvent should default URL to the last viewed

Referring to
https://github.com/piwik/piwik-sdk-android/blob/master/piwik-sdk/src/main/java/org/piwik/sdk/Tracker.java#L321 and https://github.com/piwik/piwik-sdk-android/blob/master/piwik-sdk/src/main/java/org/piwik/sdk/Tracker.java#L686

The events tracked by Tracker.trackEvent() is likely to be defaulted to "http://HOST/", since trackEvent() does not take URL as argument. This is very likely to be wrong, and this behaviour is inconsistent with Javascript and the iOS SDKs.

We should retain the URL of the last screen view, and use it for all subsequent events. This is implemented in iOS SDK (see https://github.com/piwik/piwik-sdk-ios/blob/0ddb5078f5ed4248bcac424639ff89e5b5c30aa7/PiwikTracker/PiwikTracker.m#L485)

Integration problem

Hello,

I would like to have some help regarding integration of android sdk with my app. I am not a seasoned developer and hence trying hard to see piwik working with my app.

So my question are:
I am using my registered trial piwikpro cloud domain as a trackerurl. Am I doing it right? I have tried doing the same in my app and example app you have given in this repository. Please let me know if you need any further details i.e code or snapshot in order to rectify the issue. Currently, I see no bug or warning in the code

My second query is regarding you example app. Does it shows the usage log itself or it sends its usage log to piwik dashboard? It is not so intuitive, and the app shows no responce against clicks. Can you please provide some details about this on your forum. It would be very nice nd helpful for average programmers like me :)

Looking forward to hear from you.

Thanks & regards,
Fahad

Trusting System.currentTimeMillis()

We are currently using System.currentTimeMillis() for the values first_visit and previous_visit.
If the user changes the system time, gets a NTP update or wtf else, this value can jump leading to freak values in the Piwik Dashboard.

Basically this is an issue because the user has to send these values and we have to trust them.

I currently see no better solution for it than just letting the freak values drown in the data pool as they probably won't tip the scale.

Let users track Custom Dimensions

In matomo-org/matomo#9129 we created a new plugin to track Custom Dimensions.

To the JavaScript Tracker we added a new method setCustomDimension(int dimensionId, string dimensionValue). This sets a tracking API parameter dimension$dimensionId=$dimensionValue. Eg dimension1=foo or dimension2=bar. So the tracking API parameter starts with dimension followed by the set dimensionId.

I reckon we should be consistent here with the PHP Tracker and clear all set custom dimensions after the next tracking request was sent.
eg

setCustomDimension(1, 'myvalue1')
setCustomDimension(2, 'myvalue2)
trackPageview()
// now dimension 1 and 2 would be cleared and one has to set values again

FYI: Custom Dimensions are similar to Custom Variables. Currently a plugin is needed to use them but in Piwik 3.0 it will be installed by default and at some point we will deprecate Custom Variables (not soon though)

Handle search events

Dear guys,

I'm using this library to creating analytics for my android app. It's a greate project, but I'm missing some little features or I have just not found them yet.

I would like track search events. In php I can do it with the function doTrackSiteSearch($searchValue, $searchCat, $resultCounts) but in this Android SDK I missing this or a similar function.
Also I haven't found a function, with which I can set URL-variables manually. For search events, I could set the URL-variables &search, &search_cat and &search_count in the url request, but I don't know how I can fireing an custome request with this sdk.

May be somebody has the same problem and a solution for me.

Much thanks

Version 1.0.0 ?

Hi @dotsbb

When do you think we could release version 1.0.0 of the Android SDK?

What would you like to include in this 1.0.0 release?

How can I show returning visitors on Visitor log menu?

On my Piwik server
When I go to menu Visitors -> Visitor log -> visitors
and view data I got a question that it didn't show icon returning user only on Android Device
capture2
but others always show e.g. iOS, WebBrowser.
capture

P.S. I've tested on my application that always setNewSession on new login

---> In deeply , I found on "Tracker.class"
Line 101: this.visitorId = this.getRandomVisitorId();
Line 590: private String getRandomVisitorId() {
return UUID.randomUUID().toString().replaceAll("-", "").substring(0, 16);
}

No tracking

I implemented Piwik in my app just like the sample code but it doesn't track anything. Only works on iOS. Are there any known issues with the SDK that make tracking impossible at this moment?

Testing the Android SDK for Piwik

The goal of this project is to build a SDK for Android to measure your apps with Piwik. We have started implementing the SDK. We are now looking for help from the community to review and test our Android SDK!

If you are:

  • familiar with SDK app development
  • familiar with Java
  • and you can spare a bit of time to help us review the SDK and test it on your Android App

please leave a comment in this issue.

With your help we can make the official Android SDK for Piwik a success ๐Ÿ‘ Thank you!

(we will notify you here as soon as the SDK is ready to be reviewed and tested!)

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.