@activeprospect/leadconduit-stats v4.2.4
LeadConduit Statistics
Aggregate outcome reporting for LeadConduit events. All queries are performed and results given in the account's time zone.
Library Usage
Install to your project:
npm install @activeprospect/leadconduit-stats --save
Then invoke the function passing the query options:
const stats = require('@activeprospect/leadconduit-stats');
const options = {
projectId: '12345',
readKey: '67890'
};
stats options, (err, results) ->
if (err) throw err;
console.log(results);
Query Options
The below options are supported:
Option | Description | Default | Options |
---|---|---|---|
projectId | Required Keen project ID | none | none |
readKey | Required Keen API read key | none | none |
start | Include events that occured at this time or after | Today, beginning of day | Any Date or date String in ISO8601 format |
end | Include events that occured at this time or before | Today, end of day | Any Date or date String in ISO8601 format |
columns | The columns to aggregate (or Array of outcomes) | source-success , source-failure , source-error | See the "Columns" section below |
types | The event type to aggregate (or Array of event types) | source | source , recipient , filter , feedback-received , feedback-sent |
by_lead | Boolean indicating whether to count unique leads or unique events (true counts by lead) | true | Boolean |
interval | Groups results into sub-timeframes spanning a specified length of time | none | minutely , hourly , daily , weekly , monthly , yearly |
group_by | Groups results categorically, by co-occurrence of the specified property (provide an Array of properties to group on multiple) | none | Any event property |
rules | Array of rules to filter events | [{ lhv: 'type', op: 'ne', rhv: 'filter' }]' | Array of Rules |
timezone | When an interval is specified, this time zone will be used to set the start and end of each interval | UTC | Any tz database time zone name (i.e. America/Chicago) or the number of seconds to offset time from UTC (i.e. -18000) |
format | The result format to return | json | json , csv |
Columns
The following columns are supported. The default columns are success
, failure
, and error
.
success
— count the number of events with a success outcomefailure
— count the number of events with a failure outcomeerror
— count the number of events with an error outcomesource
— count the number of source eventsrecipient
— count the number of recipient eventsfilter
— count the number of filter eventsfeedback-received
— count the number of feedback-received eventsfeedback-sent
— count the number of feedback-sent events{{event type}}-{{outcome}}
— count the number of a specific type of event with a success, failure, or error outcome{{feedback type}}-received
— count the number of a specific type of feedback received events with a success outcome{{feedback type}}-received-{{outcome}}
— count the number of a specific type of feedback received events with a success, failure, or error outcome{{feedback type}}-sent
— count the number of a specific type of feedback sent with a success outcome{{feedback type}}-sent-{{outcome}}
— count the number of a specific type of feedback received sent with a success, failure, or error outcomecost
— the sum of all matching events'cost
propertyrevenue
— the sum of all matching events'revenue
propertyprofit
— the difference betweenrevenue
andcost
cost-per-conversion-received-success
— the cost for each successful conversion that occurred for the leads submitted during the specified timeframe
The {{outcome}}
placeholders can be replaced with any outcome: success
, failure
, error
, or submitted
. The submitted
outcome isn't a true outcome and represents the success
, failure
, and error
outcomes as one. The {{feedback type}}
placeholders can be replaced with any feedback type. Currently the feedback types supported by the LeadConduit UI are
return
and conversion
. The {{event type}}
placeholders can be replaced with: source
, recipient
, filter
,
feedback-received
, or feedback-sent
.
CLI Usage
To use the command line library for LeadConduit Stats, first install it globally:
npm install @activeprospect/leadconduit-stats -g
Then run the help to see all the options. The only required option is the API Key.
$ leadconduit-stats --help
Usage: leadconduit-stats
Options:
--api-key Alpha-numeric LeadConduit API key [required]
--start Start time for query in ISO8601 format [default: "2017-10-05T00:00:00"]
--end End time for query in ISO8601 format [default: "2017-10-05T23:59:59"]
--column The column to aggregate [array] [default: ["success","failure","error","feedback-received","feedback-sent"]]
--type The event type to aggregate [array] [default: ["source"]]
--interval Groups results into sub-timeframes spanning a specified length of time: minutely, hourly, daily, weekly, monthly, yearly
--group-by Groups results categorically, by co-occurrence of the specified property [array] [default: ["vars.source.name","vars.flow.name"]]
--rule Include only events that match this rule (i.e. 'vars.source.name is equal to "Fluent"') [array] [default: ["type is equal to \"source\""]]
--format Format for query results: json or csv [default: "csv"]
--help Show help [boolean]
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago