0

I wish to run an offline analytics on my old piwik data using php-mysql.

Is there a way to programmatically access the archived blobs of piwik? Where can I find more information about the structure of the tables using in piwik?

my account_ram
  • 325
  • 3
  • 11
  • See this one: http://stackoverflow.com/questions/27622759/piwik-database-piwik-archive-blob-value-column/27625608#27625608 – quba Feb 20 '16 at 13:11

3 Answers3

0

Here are a few resources regarding the piwik api

http://developer.piwik.org/api-reference/classes

my account_ram
  • 325
  • 3
  • 11
0

If you wish to run offline analytics, you'd have to use both archived blobs and numeric tables because

  1. Archived blob tables store everything that is not a number
  2. Archived numeric tables store everything that is a number

And both of the tables are again encoded into a different form, example binary for ...archive_numeric...

So, i'd suggest, if you can't manage decoding the tables, you can take data snapshots of all the tables you require and then perform analysis as you wish.

Aseem Upadhyay
  • 4,279
  • 3
  • 16
  • 36
0

You can see the data in the blob using this example:

  1. Download the blob as a .bin using something a tool like phpmyadmin
  2. Load the file into PHP, uncompress and unserialze it using the following:

    <?php $sBlobFile = file_get_contents( 'piwik_archive_blob_2017_03-value.bin' ); $sBlobFile = unserialize( gzuncompress ( $sBlobFile ) ); var_dump( $sBlobFile );

Of course you can also just retrieve the blob using MySQL and access it directly in PHP opposed to downloading it as a file first.

Regarding the data structure, I could not find anything in the Mamtomo docs on what the values in the array structure within the blob represent.