---
id: 2996
title: "Adding Segment for React"
source_domain: hackerone.com
source_url: "https://www.hackerone.com/blog/adding-segment-react"
published_at: "2020-07-01T01:00:00Z"
tags: ["analytics", "javascript", "react", "segment", "spa", "single-page-app"]
phying_url: "https://phying.com/item/2996"
lang: en
---

# Adding Segment for React

## Summary

A guide to integrating Segment analytics in a React SPA: adding the JS snippet, hooking browser history so analytics.page() fires on client-side route changes, and identifying users.

## Intelligence Metadata

- **Sources:** hackerone.com
- **Published:** 2020-07-01T01:00:00Z
- **Original:** https://www.hackerone.com/blog/adding-segment-react
- **Phying News:** https://phying.com/item/2996
