Blue Triangle Help Center
Auto Light Dark
Auto Light Dark

Resource Endpoint

Summary

The /resource endpoint is designed to return summed or averaged resource level data. Timing data is based on the W3C Resource Timing API.

Endpoint URL

https://api.bluetriangletech.com/resource

Basic Example

Request

curl -X POST "https://api.bluetriangletech.com/resource" \
-H "X-API-Email: email@company.com" \
-H "X-API-Key: 2831ac6dffec75a48fe712345e000481" \
-H "Content-Type: application/json"
--data ‘{"site":"demo","start":"1477972800","end":"1479877200","limit":100,
"page":1,"dataColumns":["duration","elementCount"],"group":["domain"]}’

/resource Required Parameters

Name

Type

Description

Options/Constraints

site

string

Site the data is being pulled from. Uses the unique ID associated with your tag.

None

start

integer

Start time of the data in epoch time.

epoch (seconds)

end

integer

End time of the data in epoch time.

epoch (seconds)

group

array

Group the data. If grouping by time, bucketSize and bucketValue will be available.

Limited to 3 columns.

Current list of grouping parameters.

dataColumns

array

Performance data columns to be retrieved. All timings are returned in milliseconds.

Options and descriptions listed below.

dataType

string

If data returned should be RUM or Synthetic. Defaults to "rum".

  • rum

  • synthetic

/resource Optional Parameters

Arithmetic and Data Formatting

 Key

 Type

 Description

 Value

 avgType

 string

 The statistical method used for calculations.

  • geometric

  • arithmetic

  • percentile

percentile

 integer or array

  The value(s) used for the percentile distribution.
 Only available when using the avgType of percentile.

 

 bucketSize

 string

 Whether to group the data by minute, hour, or day.   Only available if grouping by ‘time’. Minute bucket is   available for time periods less than 6 hours. Hour   bucket is available for less than 14 days. Day bucket   is available for greater than 2 days.

  • minute: < 6 hours

  • hour: > 3 days && < 21 days

  • day: > 2 days

 bucketValue

 string    or   integer

 Determines the size of the bucket size. For example,   if “bucketSize” is set to minute and “bucketValue is   set to 15, the data will return in 15 minute   increments.

  • minute: < 60 minutes

  • hour: < 24 hours

  • day: > 2 days

 domainActivity

 boolean

 Returns the data formatted for domain activity. Note: secondSort must also be specified and set to true.

 true/false

 trimDomainActivity 

 integer

Only used with domainActivity. Cut the data off at the specified time since the beginning of page load. Note: If the file's start time is before the cutoff, the entire load duration is included even after cutoff.

 milliseconds

 addFileDetails

 boolean

Only used with domainActivity. Includes the file level details as a subset of the domain data.

 true/false

Data Filtering

Name

Type

Description

Options/Constraints

urlSearch

 string

 Filters data based on a URL substring. Wildcards (*) may be used. Exact match is assumed unless wildcard(s) specified.

 Limited to 7 days

pageName

array

Filters data by page name.

 

pageGroup

array

Filters data by page group.

 

trafficSeg

array

Filters data by traffic segment.

 

browser

array

Filters data by browser.

 

device

array

Filters data by device.

 

os

array

Filters data by operating system.

 

country

array

Filters data by country.

ISO 3166 format

region

array

Filters data by region. http://www.maxmind.com/download/geoip/misc/region_codes.csv

ISO 3166 format with region ID numbers

netspeed

array

Filters data by netspeed.

  • other

  • dialup

  • cable

  • corporate

  • cellular

campaignSource

array

Filters data by traffic source.

 

campaignName

array

Filters data by the campaign name.

 

campaignMedium

array

Filters data by traffic medium.

 

abSegment

array

Filters data by an A/B segment.

 

datacenter

array

Filters data by data center.

 

isp

array

Filters data by Internet Service Provider (ISP).

 

botTraffic

string

Filters data by different types of bot traffic. Bots are excluded by default.

  • includeBots

  • botsOnly

  • excludeBots

visitorType

array

Filters data by return visitors or new visitors. Defaults to include both.

  • returning

  • new

 agentLocation

 string    or   array

 Returns the location code of the synthetic agent. Only available   for dataType of "synthetic". 

 Current list of agent codes. 

domain

array

Filters data by domain. (e.g. the ‘bluetriangle.com’ part of www.bluetriangle.com)

 

file

array

Filters data by resource.

 

host

array

Filters data by host. (e.g. the ‘www’ part of www.bluetriangle.com). If there are multiple (e.g., www.d.btttag.com), this will filter for the first one.  

 

minSample

integer

Limits the data returned by sample size.

The default setting is 100

removeGetParams

 boolean

 Removes the query parameters from the URL. This option is only available when grouping by url.

 true/false

Response Formatting

Key

Type

Description

Value/Contraints

 limit

 integer or string

 Limits the number of rows returned.

 Max of 5,000 rows.

 page

 integer

 Which page currently being viewed if the rows of data pass the   limit.

 

 order

 string or   array

 Orders the data by column. If used as an array, the "sort”   parameter must be in the same order as the “order”. For example:
 “order”:[“device”,pageHits”], “sort”:[“asc”,”desc”]
 In the above example, device will be in ascending order and   pageHits will be in descending order.

  • time

  • pageHits

  • pageName

  • country

  • region

  • trafficSeg

  • browser

  • os

  • device

 sort

 string or   array

 Indicates whether the data is sorted by ascending or descending.

  • asc

  • desc

 secondSort

 boolean

 Required when using domainActivity. This option ensures the   data is properly sorted by start time.

 true/false

Group By Options

Group Options

Description

Configuration Required?

time

Time Period

No

pageName

Page Name

Yes

pageGroup

Page Group

Yes

trafficSeg

Traffic Segment

Yes

country

Country

No

region

Region

No

browser

Browser

No

os

Operating System

No

device

Device

No

browserVersion

Browser and version

No

netspeed

Speed of the network connection

No

visitorType

Return vs New Visitor

No

httpCode

HTTP Code (only available for synthetic dataType)

No

campaignSource

Traffic/Campaign Source

No

campaignMedium

Traffic/Campaign Medium

No

campaignName

Campaign Name

Yes

isp

Internet Service Provider

No

abSegment

A/B Segment

Yes

datacenter

Data Center

Yes

file

File name

No

domain

Domain name

No

host

Host name

No

fileType

script, font, style, etc.

No

location

The HTML tag the element is in (e.g. head, body, etc.). Only available for synthetic data.

No

syncType

async or sync. Only available for synthetic data.

No

inventoryAnalysis

To be used with "Service"

No

service

Service name

No

/resource Data Column Definitions

Data Column Option

Description

duration

Total load time of the resource (milliseconds)

dns

DNS time (milliseconds)

appCache

Time to retrieve the resource from cache (milliseconds)

tcp

TCP connection time (milliseconds)

ssl

SSL time (milliseconds)

redirect

Redirect time (milliseconds)

request

Time it takes to request the resource (milliseconds)

response

Time it takes to receive the last byte of the response (milliseconds)

startTime

Average start time for the resource (milliseconds)

elementCount

Sum of the resources captured on a page hit. If grouping by file or domain, then this will return the count for each file or domain. Percentile avgType not applicable.

fileSize

Average total encoded size for all resources captured on a page hit (bytes)

/resource Additional Examples

Multiple Percentiles

In this example, we are requesting multiple percentile values. As you can see in the response, each metric supporting this calculation will have a value for each requested percentile. Also, the percentile value is appended to the name of the metric (e.g. "duration-90", "duration-80," etc.).

Request JSON

{
  "site": "demo",
  "start": "1580274000",
  "end": "1580360400",
  "dataColumns": [
    "duration",
    "elementCount",
    "startTime"
  ],
  "group": [
    "domain"
  ],
  "avgType":"percentile",
  "percentile": [90,80,70,60,50],
  "dataType": "rum",
  "order": "elementCount", 
  "sort": "desc",
  "limit": 1000,
  "minSamples": 20
}

Response JSON

{
  "requestsAllowed": "10000",
  "requestsMade": 2,
  "site": "demo",
  "status": 1,
  "totalItems": 41,
  "data": [
    {
      "domain": "Sports.com",
      "duration-90": "815",
      "duration-80": "355",
      "duration-70": "209",
      "duration-60": "145",
      "duration-50": "106",
      "elementCount": "912581",
      "startTime-90": "16037",
      "startTime-80": "7828",
      "startTime-70": "4422",
      "startTime-60": "2755",
      "startTime-50": "1854"
    },
    {
      "domain": "g.doubleclick.net",
      "duration-90": "487",
      "duration-80": "224",
      "duration-70": "140",
      "duration-60": "101",
      "duration-50": "80",
      "elementCount": "487284",
      "startTime-90": "14711",
      "startTime-80": "7893",
      "startTime-70": "5151",
      "startTime-60": "3521",
      "startTime-50": "2598"
    },
    ...
  ]
}

Domain Activity

This example pulls the domain activity report for our demo site for a period of 24 hours. Here we are cutting off the data after 10000 ms.

Request JSON

{
  "site": "demosports",
  "start": "1595532900",
  "end": "1595619300",
  "dataType": "rum",
  "dataColumns": [
    "duration",
    "elementCount",
    "startTime"
  ],
  "group": [
    "file",
    "domain"
  ],
  "order": "elementCount",
  "sort": "desc",
  "limit": "500",
  "minSample": 100,
  "botTraffic": "excludeBots",
  "domainActivity": true,
  "trimDomainActivity": 10000
}

Response JSON

{
  "requestsAllowed": "10000",
  "requestsMade": 1,
  "site": "demo",
  "status": 1,
  "totalItems": 37,
  "data": {
    "btttag.com": {
      "elementCount": 104735,
      "domainDuration": 215
    },
    "g.doubleclick.net": {
      "elementCount": 210745,
      "domainDuration": 708
    },
    "google.com": {
      "elementCount": 178031,
      "domainDuration": 397
    },
    ...
  }
}

Services

This example groups the information in the data columns by service ("Service A" and "Service B"). 

{
    "site": "demosports",
    "start": "1638215046",
    "end": "1638301446",
    "limit": 100,
    "page": 1,
    "dataColumns": [
        "duration",
        "elementCount",
        "startTime"
    ],
    "group": [
        "service"
    ],
"service": ["Service A", "Service B"],
"order":"startTime",
"sort":"asc"
}