New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@loganbussey/change-segment-metric-host

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loganbussey/change-segment-metric-host

When changing the Segment `apiHost` to point to a proxy using the integration options on the `analytics.load()` call, `identify`, `page`, `track`, and `screen` calls will be made to your proxy, but Segment's internal metric calls will still be made to `ap

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

Segment Metrics API Host Changer

When changing the Segment apiHost to point to a proxy using the integration options on the analytics.load() call, identify, page, track, and screen calls will be made to your proxy, but Segment's internal metric calls will still be made to api.segment.io. There's no way to pass in a different metrics host and you would usually have to contact their support team to ask them to change the tracking code loaded by the snippet. This small script intercepts XHR requests and modifies the URL of metric calls to go through your proxy instead.

E.g. When using the following code to change the apiHost,

analytics.load("yourWriteKey", {
  integrations: {
    "Segment.io": {
      apiHost: "segment.example.com/v1",
    },
  },
});

Installation & Usage

NPM

$ npm install @loganbussey/change-segment-metric-host --save
import changeMetricHost from '@loganbussey/change-segment-metric-host';

changeMetricHost('api.example.com');

Keywords

FAQs

Package last updated on 05 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc