API Documentation > action
Description
Log and query user actions.
Log records, in addition to the traditional fields like referrer and ip address, are composed of a named action and a tag. The action is simply a free-form string. The tag is an object/array with any number of fields of any value including nested objects/arrays. Here is a simplified example of a log record:
{
action: 'button.click',
tag: {
item_id: '123abc',
network: 'twitter',
referral: {
network: 'facebook',
user_id: 'foo23'
}
}
}
When querying log data, it is possible to filter and/or aggregate actions by one
or more tag fields, except when querying unique actions. In order to provide
reasonable performance when querying unique actions, a specialized index is
used. This index does not support aggregation by tag fields and supports filtering
only by predefined groups of tag fields known as scopes. For example,
<tag.group,tag.network> is a scope. If present in the index,
it is possible to get a count of unique actions filtered by
tag.group and tag.network. If you wanted
to get a unique count of an action filtered by group and not network you
would use a different scope, namely <tag.group>.
These are the currently defined scopes:
<tag.network> - The social network involved in the action.
For example, in the case of a sharelink.click, tag.network
is the social network where the share link was posted.
<tag.traffic_source> - The auto-generated traffic source based
on referrer. It may be one of search, direct, click.st or other.
<tag.group> - A user-defined string for a group.
<tag.group,tag.traffic_source> - Combination of group and traffic source.
<tag.group,tag.network> - Combination of group and network.
List of known actions currently in use:
-
pageview- Click.st script loaded on page. -
button.load- A share button is drawn. -
button.click- A share button is clicked. Implies a share but does not guarantee one. -
email.send- A share email was sent. This is a guaranteed share. -
sharelink.click- A shared link was clicked. -
conversion- A user was converted. The exact meaning of a conversion is application dependent.
Methods
action.find()
Query a view.
Arguments
The name of the view to query.
Conditions on dimensions of the view.
Beginning of time range (inclusive)
End of time range (exclusive)
If true, return series data
If returning series data, aggregate on the given period (month, week day).
action.find_batch()
Perform a number of queries and return the results.
Arguments
An array of argument arrays for find()
action.get_external_stats()
Get stats about social activity outside of click.st
Arguments
A unix timestamp specifying the beginning of the time window (inclusive).
A unix timestamp specifying the end of the time window (exclusive).
A filter object.
action.log()
Log an action
Arguments
The name of the action being taken.
This should be something short and descriptive and should represent a unique user action.
The URL at which the action is taken.
The URL that linked to the current (action) URL.
An object of arbitrary complexity specifying additional information.
For instance, the tag for a button.click action might look like this:
tag: {
item_id: '123abc',
network: 'facebook'
}
The ip address of the user taking the action.
The user agent string of the user taking the action.

