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

refactor: separate google and mixpanel builds #31

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions doc/gtag_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#### **`app.tsx`**

```jsx
import { LoadGA4 } from '@freshheads/analytics-essentials/google';

const App = () => {
return (
<>
Expand All @@ -23,14 +25,13 @@ const App = () => {
};
```


## Usage

```js
import {
EventType,
pushGaEvent,
} from '@freshheads/analytics-essentials';
} from '@freshheads/analytics-essentials/google';

pushGaEvent({
type: EventType.CLICK,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion lib/main.ts → lib/google/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ export * from './tagManager';
export * from './GA4';
export * from './constants';
export * from './components';
export * from './mixpanel';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 22 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
{
"name": "@freshheads/analytics-essentials",
"version": "0.0.5-3",
"version": "0.0.5-4",
"keywords": [
"Analytics",
"Tag Manager",
"Freshheads"
],
"description": "Configure and use Google Analytics and Google Tag Manager in your Next.js app.",
"description": "Essentials for setting up analytics with Mixpanel, Google Analytics and Google Tag Manager",
"type": "module",
"types": "dist/types/main.d.ts",
"main": "dist/analytics-essentials.cjs",
"module": "dist/analytics-essentials.js",
"main": "dist/mixpanel.cjs",
"module": "dist/mixpanel.js",
"types": "dist/types/mixpanel/index.d.ts",
"exports": {
".": {
"types": "./dist/types/mixpanel/index.d.ts",
"import": "./dist/mixpanel.js",
"require": "./dist/mixpanel.cjs"
},
"./mixpanel": {
"types": "./dist/types/mixpanel/index.d.ts",
"import": "./dist/mixpanel.js",
"require": "./dist/mixpanel.cjs"
},
"./google": {
"types": "./dist/types/google/index.d.ts",
"import": "./dist/google.js",
"require": "./dist/google.cjs"
}
},
"files": [
"dist",
"doc"
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ npm i @freshheads/analytics-essentials

### Usage by analytics provider

- [Mixpanel Setup](doc/mixpanel_setup.md)
- [Gtag Setup](doc/gtag_setup.md)
- [Tagmanager Setup](doc/tagmanager_setup.md)
- [Mixpanel](doc/mixpanel_setup.md)
- [Gtag](doc/gtag_setup.md)
- [Tagmanager](doc/tagmanager_setup.md)
6 changes: 4 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ export default defineConfig({
build: {
outDir: 'dist',
lib: {
entry: resolve(__dirname, 'lib/main.ts'),
name: 'main',
entry: {
google: resolve(__dirname, 'lib/google/index.ts'),
mixpanel: resolve(__dirname, 'lib/mixpanel/index.ts'),
},
formats: ['es', 'cjs'],
},
rollupOptions: {
Expand Down
Loading