Skip to main content
TroopyDocs
Open Troopy
Troopy

API reference / Analytics

Get the search keywords

The Google searches that brought visitors in the period, from the Google Search Console connection of the workspace. Each search has its clicks, impressions, CTR, average position and the revenue that it probably brought. Troopy splits the Google revenue of each landing page among the searches that led there, by their clicks. A page filter keeps only the pages that contain it. connected is false until the workspace connects Search Console in Settings > Apps.

get/api/v1/analytics/keywords

Authorization

HeaderAuthorization: Bearer <API key>
Or the headerX-API-Key: <API key>
API keyMake one in Troopy under Settings > API keys. It acts as you, in its workspace.

Other ways to call it

CLItroopy analytics keywords
MCP tooltroopy_get_analytics_keywords
Rate limit60 calls in 60 seconds, for each key

Query parameters

periodenum<string>

now is the last 10 minutes. 7d and 30d end today. 3m, 6m and 12m are whole months that end with this month. week starts on Monday. custom needs from and to

nowtodayyesterday24h7d30d3m6m12mweekmonthyearallcustom

Default "30d"

fromstring

YYYY-MM-DD, in the workspace's time zone

date

tostring

YYYY-MM-DD. The period includes this day

date

compareenum<string>

Also gives another window: previous is the window just before, with the same length. year is the same days a year before. custom is compare_from to compare_to

previousyearcustom

compare_fromstring

With compare custom: the first day of the other window

date

compare_tostring

With compare custom: the last day of the other window

date

filter_channelstring

channel: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_referrerstring

referrer: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_utm_sourcestring

utm source: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_utm_mediumstring

utm medium: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_utm_campaignstring

utm campaign: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_utm_termstring

utm term: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_utm_contentstring

utm content: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_refstring

ref: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_sourcestring

source: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_viastring

via: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_pagestring

page: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_entry_pagestring

entry page: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_exit_pagestring

exit page: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_hostnamestring

hostname: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_countrystring

country: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_regionstring

region: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_citystring

city: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_languagestring

language: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_browserstring

browser: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_osstring

os: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_devicestring

device: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_screenstring

screen: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_goalstring

goal: op:value[,value]. The op is is, is_not, contains, does_not_contain, matches (a regular expression) or does_not_match. No op means is. More values mean any of them. (none) matches an empty value, as for direct traffic

At most 500 characters

filter_propertystring

Visitors who sent a goal with a property: op:name=value[,name=value], such as is:plan=pro. The op is one of is, is_not, contains, does_not_contain, matches and does_not_match

At most 500 characters

filter_visit_countstring

Sessions by the visitor's visit number: is:1 (new), gte:2 (returning), lte, is_not

At most 500 characters

limitinteger

Default 10 · At least 1 · At most 500

Response

200 · application/json
data*object
5 properties
connected*boolean
available*boolean

false when this server has no Google client to connect Search Console with

property*string | null

The Search Console property that Troopy read, or null when nobody chose one

keywords*array<object>
6 properties
query*string
clicks*integer
impressions*integer
ctr*number

0 to 1

position*number

The average position. 1 is the top

revenue*integer

An estimate, in minor units

total*integer

Errors

400 invalid_inputFix the field named in detail. Each operation's schema is in /api/v1/openapi.json.
401 unauthorizedSend an API key as `Authorization: Bearer tr_live_...`. Create one in Troopy under Settings.
403 forbiddenThe key lacks a scope this operation needs, or its owner lacks the role. detail says which; create a key with the scope, or ask an organization owner or admin.
429 rate_limitedWait the number of seconds in Retry-After, then retry.