gtm-react-hook
Advanced tools
Comparing version 0.0.13 to 0.0.14
124
package.json
{ | ||
"name": "gtm-react-hook", | ||
"description": "Easy-to-use React hooks for Google Tag Management based on TypeScript", | ||
"version": "0.0.13", | ||
"dependencies": { | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.23.7", | ||
"@babel/preset-env": "^7.23.8", | ||
"@babel/preset-react": "^7.23.3", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@changesets/cli": "^2.27.1", | ||
"@testing-library/react": "^14.1.2", | ||
"@types/jest": "^29.5.11", | ||
"@types/react": "^18.2.48", | ||
"@types/react-dom": "^18.2.18", | ||
"@types/react-test-renderer": "^18.0.7", | ||
"@typescript-eslint/eslint-plugin": "^6.19.0", | ||
"@typescript-eslint/parser": "^6.19.0", | ||
"babel-jest": "^29.7.0", | ||
"babel-loader": "^9.1.3", | ||
"eslint": "^8.56.0", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"eslint-plugin-react-refresh": "^0.4.5", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"react-test-renderer": "^18.2.0", | ||
"tsup": "^8.0.1", | ||
"typescript": "^5.3.3", | ||
"webpack": "^5.89.0", | ||
"webpack-cli": "^5.1.4", | ||
"webpack-dev-server": "^4.15.1" | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"license": "MIT", | ||
"author": { | ||
"name": "Valerii Shelihan", | ||
"email": "valerasheligan@gmail.com", | ||
"url": "https://github.com/mara1esh" | ||
}, | ||
"repository": { | ||
"type": "github", | ||
"url": "https://github.com/mara1esh/gtm-react-hook" | ||
}, | ||
"homepage": "https://github.com/mara1esh/gtm-react-hook#readme", | ||
"keywords": [ | ||
"react", | ||
"hooks", | ||
"analytics", | ||
"gtm", | ||
"google tag manager", | ||
"typescript" | ||
], | ||
"scripts": { | ||
"start": "webpack serve --open", | ||
"release": "pnpm run build && changeset publish", | ||
"build": "tsup", | ||
"lint": "tsc", | ||
"test": "jest" | ||
} | ||
"name": "gtm-react-hook", | ||
"description": "Easy-to-use React hooks for Google Tag Management based on TypeScript", | ||
"version": "0.0.14", | ||
"scripts": { | ||
"start": "webpack serve --open", | ||
"release": "pnpm run build && changeset publish", | ||
"build": "tsup", | ||
"lint": "tsc", | ||
"test": "jest" | ||
}, | ||
"dependencies": { | ||
"react": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.23.7", | ||
"@babel/preset-env": "^7.23.8", | ||
"@babel/preset-react": "^7.23.3", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@changesets/cli": "^2.27.1", | ||
"@testing-library/react": "^14.1.2", | ||
"@types/jest": "^29.5.11", | ||
"@types/react": "^18.2.48", | ||
"@types/react-test-renderer": "^18.0.7", | ||
"@typescript-eslint/eslint-plugin": "^6.19.0", | ||
"@typescript-eslint/parser": "^6.19.0", | ||
"babel-jest": "^29.7.0", | ||
"babel-loader": "^9.1.3", | ||
"eslint": "^8.56.0", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"eslint-plugin-react-refresh": "^0.4.5", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"react-test-renderer": "^18.2.0", | ||
"tsup": "^8.0.1", | ||
"typescript": "^5.3.3", | ||
"webpack": "^5.89.0", | ||
"webpack-cli": "^5.1.4", | ||
"webpack-dev-server": "^4.15.1" | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"license": "MIT", | ||
"author": { | ||
"name": "Valerii Shelihan", | ||
"email": "valerasheligan@gmail.com", | ||
"url": "https://github.com/mara1esh" | ||
}, | ||
"repository": { | ||
"type": "github", | ||
"url": "https://github.com/mara1esh/gtm-react-hook" | ||
}, | ||
"homepage": "https://github.com/mara1esh/gtm-react-hook#readme", | ||
"keywords": [ | ||
"react", | ||
"hooks", | ||
"analytics", | ||
"gtm", | ||
"google tag manager", | ||
"typescript" | ||
] | ||
} |
@@ -7,5 +7,5 @@ # 📊 Easy-to-use React hooks for Google Tag Management based on TypeScript | ||
- Fully typed with TypeScript | ||
- Small bundle size <4k | ||
- Small bundle size <4kB | ||
- Support tools for custom GTM configuration | ||
- Zero dependencies | ||
- React.js is the only dependency | ||
- Logging events | ||
@@ -86,14 +86,12 @@ - Test covered | ||
```typescript | ||
const { eventGTM } = useGTM(); | ||
const { eventGTM } = useGTM(); | ||
const handleSaveCustomerInfo = (customer) => { | ||
eventGTM("customer_info", { | ||
customerId: customer.customerId, | ||
customerRegion: customer.customerRegion | ||
}); | ||
} | ||
const handleSaveCustomerInfo = (customer) => { | ||
eventGTM("customer_info", { | ||
customerId: customer.customerId, | ||
customerRegion: customer.customerRegion, | ||
}); | ||
}; | ||
...JSX... | ||
<button onClick={handleSaveCustomerInfo}>Submit</button> | ||
return <button onClick={handleSaveCustomerInfo}>Submit</button>; | ||
``` | ||
@@ -100,0 +98,0 @@ |
import { useRef, useMemo, useCallback } from "react"; | ||
import { createTags } from "../utils/tags"; | ||
import { DEFAULT_DATALAYER_NAME } from "../utils/consts"; | ||
import type { GTMConstructor } from "../typings/typedefs"; | ||
import { createTags } from "@/utils/tags"; | ||
import { DEFAULT_DATALAYER_NAME } from "@/utils/consts"; | ||
import type { GTMConstructor } from "@/typings/typedefs"; | ||
@@ -6,0 +6,0 @@ const useGTM = () => { |
@@ -1,2 +0,2 @@ | ||
import type { GTMConstructor, GTMEnvironment } from "../typings/typedefs"; | ||
import type { GTMConstructor, GTMEnvironment } from "@/typings/typedefs"; | ||
@@ -3,0 +3,0 @@ import { |
Sorry, the diff of this file is not supported yet
34711
1
24
136
- Removedreact-dom@^18.2.0
- Removedreact-dom@18.3.1(transitive)
- Removedscheduler@0.23.2(transitive)