How to use third-party-web - 9 common examples

To help you get started, we’ve selected a few third-party-web examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sitespeedio / sitespeed.io / lib / plugins / thirdparty / index.js View on Github external
processMessage(message, queue) {
    const make = this.make;
    const thirdPartyAssetsByCategory = {};
    const toolsByCategory = {};
    const possibileMissedThirdPartyDomains = [];
    if (message.type === 'pagexray.run') {
      const firstPartyRegEx = message.data.firstPartyRegEx;
      for (let d of Object.keys(message.data.domains)) {
        const entity = d.indexOf('localhost') > -1 ? undefined : getEntity(d);
        if (entity !== undefined) {
          // Here is a match
        } else {
          if (!d.match(firstPartyRegEx)) {
            possibileMissedThirdPartyDomains.push(d);
          }
        }
      }
      const byCategory = {};
      this.groups[message.url] = message.group;
      const company =
        message.url.indexOf('localhost') > -1
          ? undefined
          : getEntity(message.url);
      let totalThirdPartyRequests = 0;
      for (let asset of message.data.assets) {
github sitespeedio / sitespeed.io / lib / plugins / thirdparty / index.js View on Github external
possibileMissedThirdPartyDomains.push(d);
          }
        }
      }
      const byCategory = {};
      this.groups[message.url] = message.group;
      const company =
        message.url.indexOf('localhost') > -1
          ? undefined
          : getEntity(message.url);
      let totalThirdPartyRequests = 0;
      for (let asset of message.data.assets) {
        const entity =
          asset.url.indexOf('localhost') > -1
            ? undefined
            : getEntity(asset.url);
        if (entity !== undefined) {
          if (company && company.name === entity.name) {
            // Testing comnpanies that themselves are a third party gives a high third party score
            // so we should remove the ones.
            continue;
          }
          totalThirdPartyRequests++;
          if (
            entity.name.indexOf('Google') > -1 ||
            entity.name.indexOf('Facebook') > -1 ||
            entity.name.indexOf('AMP') > -1 ||
            entity.name.indexOf('YouTube') > -1
          ) {
            if (!entity.categories.includes('survelliance')) {
              entity.categories.push('survelliance');
            }
github sitespeedio / sitespeed.io / lib / plugins / thirdparty / index.js View on Github external
for (let d of Object.keys(message.data.domains)) {
        const entity = d.indexOf('localhost') > -1 ? undefined : getEntity(d);
        if (entity !== undefined) {
          // Here is a match
        } else {
          if (!d.match(firstPartyRegEx)) {
            possibileMissedThirdPartyDomains.push(d);
          }
        }
      }
      const byCategory = {};
      this.groups[message.url] = message.group;
      const company =
        message.url.indexOf('localhost') > -1
          ? undefined
          : getEntity(message.url);
      let totalThirdPartyRequests = 0;
      for (let asset of message.data.assets) {
        const entity =
          asset.url.indexOf('localhost') > -1
            ? undefined
            : getEntity(asset.url);
        if (entity !== undefined) {
          if (company && company.name === entity.name) {
            // Testing comnpanies that themselves are a third party gives a high third party score
            // so we should remove the ones.
            continue;
          }
          totalThirdPartyRequests++;
          if (
            entity.name.indexOf('Google') > -1 ||
            entity.name.indexOf('Facebook') > -1 ||
github sitespeedio / coach / lib / har / thirdParty.js View on Github external
module.exports.getThirdParty = function(page) {
  const toolsByCategory = {};
  const offending = [];
  const byCategory = {};
  let thirdPartyTransferSizeBytes = 0;
  const thirdPartyAssetsByCategory = {};
  const company =
    page && page.url.indexOf('localhost') > -1
      ? undefined
      : getEntity(page.url);
  let totalThirdPartyRequests = 0;
  for (let asset of page.assets) {
    const entity =
      asset && asset.url.indexOf('localhost') > -1
        ? undefined
        : getEntity(asset.url);
    if (entity !== undefined) {
      if (company && company.name === entity.name) {
        // Testing comnpanies that themselves are a third party gives a high third party score
        // so we should remove the ones.
        continue;
      }
      totalThirdPartyRequests++;
      if (asset.transferSize) {
        thirdPartyTransferSizeBytes += asset.transferSize;
      }
      if (
        entity.name.indexOf('Google') > -1 ||
        entity.name.indexOf('Facebook') > -1 ||
        entity.name.indexOf('AMP') > -1 ||
        entity.name.indexOf('YouTube') > -1
      ) {
github sitespeedio / sitespeed.io / lib / plugins / thirdparty / index.js View on Github external
if (!asset.url.match(firstPartyRegEx)) {
            if (byCategory['unknown']) {
              byCategory['unknown'] = byCategory['unknown'] + 1;
            } else {
              byCategory['unknown'] = 1;
            }
          }
        }
      }

      const cpuPerTool = {};
      if (message.data.cpu && message.data.cpu.urls) {
        for (let ent of message.data.cpu.urls) {
          // Seen errors like  "Unable to find domain in "about:blank"
          if (ent.url && ent.url.startsWith('http')) {
            let entity = getEntity(ent.url);
            // fallback to domain
            if (!entity) {
              const hostname = ent.url.startsWith('http')
                ? urlParser.parse(ent.url).hostname
                : ent.url;
              entity = {
                name: hostname
              };
            }
            if (cpuPerTool[entity.name]) {
              cpuPerTool[entity.name] += ent.value;
            } else {
              cpuPerTool[entity.name] = ent.value;
            }
          }
        }
github sitespeedio / coach / lib / har / thirdParty.js View on Github external
module.exports.getThirdParty = function(page) {
  const toolsByCategory = {};
  const offending = [];
  const byCategory = {};
  let thirdPartyTransferSizeBytes = 0;
  const thirdPartyAssetsByCategory = {};
  const company =
    page && page.url.indexOf('localhost') > -1
      ? undefined
      : getEntity(page.url);
  let totalThirdPartyRequests = 0;
  for (let asset of page.assets) {
    const entity =
      asset && asset.url.indexOf('localhost') > -1
        ? undefined
        : getEntity(asset.url);
    if (entity !== undefined) {
      if (company && company.name === entity.name) {
        // Testing comnpanies that themselves are a third party gives a high third party score
        // so we should remove the ones.
        continue;
      }
      totalThirdPartyRequests++;
      if (asset.transferSize) {
        thirdPartyTransferSizeBytes += asset.transferSize;
      }
github patrickhulce / third-party-web / www / src / components / data-visualizations / d3-viz.js View on Github external
import * as color from 'color'
import _ from 'lodash'
import * as thirdPartyWeb from 'third-party-web'
import * as d3plus from 'd3plus/build/d3plus.js'

const categories = _.uniq(thirdPartyWeb.entities.map(e => e.categories[0])).map((category, idx) => {
  return {
    id: category,
    displayName: _.startCase(category),
    color: color(`hsl(175, 75%, ${15 + idx * 5}%)`)
      .rgb()
      .string(),
  }
})

const data = thirdPartyWeb.entities
  .filter(entity => entity.totalOccurrences)
  .sort((a, b) => b.totalExecutionTime - a.totalExecutionTime)
  .slice(0, 100)
  .sort((a, b) => a.name.localeCompare(b.name))
  .map(entity => {
    const category = categories.find(c => c.id === entity.categories[0])

    return {
      ...entity,
      id: entity.name,
      category: category.displayName,
      color: category.color,
    }
  })

const tooltipConfig = {
github patrickhulce / third-party-web / www / src / components / data-visualizations / d3-viz.js View on Github external
import React, {useEffect, useState, useRef} from 'react'
import PropTypes from 'prop-types'
import * as color from 'color'
import _ from 'lodash'
import * as thirdPartyWeb from 'third-party-web'
import * as d3plus from 'd3plus/build/d3plus.js'

const categories = _.uniq(thirdPartyWeb.entities.map(e => e.categories[0])).map((category, idx) => {
  return {
    id: category,
    displayName: _.startCase(category),
    color: color(`hsl(175, 75%, ${15 + idx * 5}%)`)
      .rgb()
      .string(),
  }
})

const data = thirdPartyWeb.entities
  .filter(entity => entity.totalOccurrences)
  .sort((a, b) => b.totalExecutionTime - a.totalExecutionTime)
  .slice(0, 100)
  .sort((a, b) => a.name.localeCompare(b.name))
  .map(entity => {
    const category = categories.find(c => c.id === entity.categories[0])
github GoogleChrome / lighthouse / lighthouse-core / audits / third-party-summary.js View on Github external
static getEntitySafe(url) {
    try {
      return thirdPartyWeb.getEntity(url);
    } catch (_) {
      return undefined;
    }
  }

third-party-web

Categorized data on third party entities on the web.

MIT
Latest version published 2 months ago

Package Health Score

80 / 100
Full package analysis