Prerequisites / Basic Set-up
Make sure, that the option "Enable PocketQuery usage statistics" in the global Confluence Administration is enabled. If you aren't a Confluence Administrator yourself, you can check the Dashboard of the PocketQuery Administration. If the option is disabled, you will see an info text there, if the statistics are enabled you will see something like this:
Table Structure
The table contains the id of the page or blogpost the macro is included in ("content_entity_id"), a timestamp ("date"), the name of the query ("query_name") and an own unique id ("id"). Each data set represents one rendering of a PocketQuery macro.
The name of the table contains a prefix set by Confluence (that is generated using the plugin key). The whole name should end up to be something like "AO_AD3311_MACRO_USAGE".
Basic Set-up of Datasource and Query
First create a new datasource to connect to the database your Confluence is using. Use "Test Connection" to verify everything is working fine.
If you want to, you can double check the exact name of the usage table. Use a query like the following one to find it:
SHOW TABLES WHERE tables_in_demo LIKE '%MACRO_USAGE'
Execute the query with the default template and you can see the name of the table. Save it somewhere, as you will need it for each and every usage query example.