Preparing test data
To prepare report test data, run any report by going to the Reports
menu item at the top, then click + New Report
at the top right of the page.
Depending on what kind of plugin input data you've selected in step 2, you can use one of these reports:
Timerseries as plugin input data — Any report will work here, such as
User Report
. If not already available, clickAdd Item
and selectUser Count
. Then at the top right make sure the time unit corresponds with the time unit your plugin can handle. Then pick a long enough date range likeLast 180 days
and thenRun Report
.List of users as plugin input data — All report types work here, but usually you would want to use the
User Report
orCustom SQL report
. Let's say we're making an AB-testing plugin. ClickAdd Item
in the report and selectEvent count
and then the event you want to count conversion for is used to distinguish between converted users. This value is normally specified by the end-user via aPlugin input data
variable of typenumber
that you would add — a placeholder for the number of conversion events a user had.
Then at the top right make sure the time unit is set toTotal
. Next you always need to add toGroup By
theUser -> ID
field — this makes sure the data is recognized as a list of users. You can then add any otherGroup By
such asAB test variation
so that we can distinguish between the group of users and the AB-test variation they are in. Finally pick a long enough date range likeLast 180 days
and thenRun Report
.
This is a bit of a convoluted way to get a list of all users. A better way would be to use aCustom SQL
report and then query theusers
table directly. This allows for more fine-grained filtering.
Usually both cases are fine though, as aList of users
plugins are normally not being run directly by the end-user, but abstracted away in an Insight. The Insight could for example ask what user property contains the A/B test variation; this will then be used in a dynamically builtCustom SQL
query through the Insight API. If you want to go that route, you need to first build your test data through aCustom SQL report
, and for real usage you would create a custom SQL query via the Insight API to supply your plugin with data. See Insight API — Custom SQL for details, once you're ready to use your plugin in the Insight API.List of events as plugin input data — Only the
Event report
or theCustom SQL report
work here. Let's say we're making an Anomaly detection plugin. ClickAdd Item
in the report and selectUser count
— this will not be used but we need at least one report output item.
Then at the top right make sure the time unit is set toTotal
. Next, you always need to add toGroup By
theEvent -> Any event -> ID of event
field — this makes sure the data is recognized as a list of events. In addition you also need to add toGroup by
the timestamp of the event by pickingEvent -> Any event -> Created at date and time -> Date
, as well as the name of the event fromEvent -> Any event -> Name
. Finally pick a long enough date range likeLast 180 days
and thenRun Report
.
This is a bit of convoluted way to get a list of all events, especially since we cannot filter by event name to limit the amount of data returned. A better way would be to use aCustom SQL
report and to query theevents
table directly. This allows for more fine-grained filtering.
Usually both cases are fine though, asList of events
plugins are normally not being run directly by the end-user, but abstracted away in an Insight. The Insight could for example ask what event the user is interested in terms of anomaly detection; this will then be used in a dynamically builtCustom SQL
query through the Insight API. If you want to go that route, you need to first build your test data through aCustom SQL report
, and for real usage you would create a custom SQL query via the Insight API to supply your plugin with data. See Insight API — Custom SQL for details, once you're ready to use your plugin in the Insight API.
Additionally you can also add extra Segments
, Group By
or Date Ranges
to your report. This will make sure you can handle those if the end-user uses those. For example you can allow your forecasting plugin to make a forecast per country if that was added in Group By
.
This will be used mostly in Timerseries
input data plugins, as the end-user would want to see the plugin results from different angles, such as between several countries. List of users
or List of events
will typically not be run directly be end-uses on the of reports, so there will be no need to support multiple Group By
, Segments
or Date ranges
.
Once the results are in, click the Plugins
dropdown and select your plugin. You will get a popup with two keys that you have to write down for later — the Project key
and Dataset key
.