How to use the third-party-web.getEntity function in third-party-web

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;
      }

third-party-web

Categorized data on third party entities on the web.

MIT
Latest version published 1 month ago

Package Health Score

85 / 100
Full package analysis