queries:tables:field-tables

Field Tables

All fields are interpreted as custom tables. Those tables are called field tables and contain the goal data. Field tables are automatically created and can be deleted at any time.

Structure

A field table consists essentially of the following columns accessible in a query:

Name Type Description
id Identifier Contains a unique identifier for this value.
viewid Identifier Contains an identifier for the converting view.
sessionid Identifier Contains an identifier for the session.
value Numeric Contains the value which was
sent to duckprove using the JavaScript API.
time Time Contains the exact time when
the value was received.

Example Query

This is an example query for a field table named revenue. There are more examples available for all kinds of tables.

draw pie-chart
using value, year(revenue.time) as label
from revenue

The following query illustrates how many times the user comes back (creates a session) before finally converting in the revenue field table.

draw line-chart
using amount as x-value, count() as y-value
from 
(
  using count(all.id) as amount
  from revenue
  join @sessions as converter on converter.id = revenue.session_id
  join @sessions as all on all.consumer_id = converter.consumer_id
  group by all.consumer_id
) as amounts
group by amount