Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade dependencies, add options to specify the script attribute, published fork #60

Closed
wants to merge 11 commits into from
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# React Google Analytics 4
# React Google Analytics 4 - forked

## Migrate from old react-ga

```js
// Simply replace `react-ga` with `react-ga4`
// Simply replace `react-ga` with `react-ga4-forked`
// import ReactGA from "react-ga";
import ReactGA from "react-ga4";
import ReactGA from "react-ga4-forked";
```

## Install

```bash
npm i react-ga4
npm i react-ga4-forked
```

## Usage

```js
import ReactGA from "react-ga4";
import ReactGA from "react-ga4-forked";

ReactGA.initialize("your GA measurement id");
ReactGA.send("pageview");
Expand Down Expand Up @@ -66,6 +66,8 @@ ReactGA.event({
| options.gaOptions | `object` Optional [Reference](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference) |
| options.gtagOptions | `object` Optional |
| options.legacyDimensionMetric | `boolean` Default true |
| options.scriptSrc | `string` Default `https://www.googletagmanager.com/gtag/js` |
| options.scriptLoadingMode | `'async'\|'defer'\` Default `async` |

#### ReactGA.set(fieldsObject)

Expand Down Expand Up @@ -117,7 +119,7 @@ Deprecated Use `enhanced measurement` feature in Google Analytics.
### Extending

```js
import { ReactGAImplementation } from "react-ga4";
import { ReactGAImplementation } from "react-ga4-forked";

class MyCustomOverriddenClass extends ReactGAImplementation {}

Expand Down