You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+56-2Lines changed: 56 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,17 @@
1
1
# Use analytics.js without Segment (analytics-js-without-segment)
2
2
3
-
A plugin use (and render) Segments open-source analytics library (analytics.js) WITHOUT using the paid Segment service (segment.com). To be used with your favorite analytics-tools like Google Analytics, Mixpanel, Hotjar, etc.
3
+
A tool to use (and render) Segments open-source analytics library (analytics.js) **WITHOUT using the paid Segment service** (segment.com). To be used with your favorite analytics-tools like **Google Analytics, Mixpanel, Hotjar, etc.**
4
+
5
+
@Gatsby-users: Use the [related gatsby-package](https://github.com/thebarty/gatsby-plugin-analytics-without-segment).
6
+
7
+
## Features
8
+
9
+
***Best-practise loading of analytics.js**: This plugin loads [Segments analytics.js](https://github.com/segmentio/analytics.js) following [best-practises](http://www.ianww.com/blog/2017/08/06/analytics-js-standalone-library/) and enables you to easily set options (`cdnUrl` and `services`).
10
+
***Unlimited and free**: You'll use the free analytics.js and not depend on Segment (which has aggressive pay-or-leave policies, after you hit the 1000 free monthly users)
11
+
***Track events anywhere**: You can track custom-events anywhere in your code via `analytics.track()`
12
+
***Supported integrations**: A LOT of analytics-tools are supported. see https://github.com/segment-integrations.
13
+
***Development-mode**: In development you'll only see the events in the console. Your events will NOT be forwarded
14
+
***Production-mode**: All events will be routed to the services. Check your console for possible errors.
@@ -48,3 +59,46 @@ runAnalytics(options) // after running this, `analytics` is globally available
48
59
// MANUALLY attach to window.analytics and make global `analytics.*`-object available
49
60
const snippet = renderAnalytics(options)
50
61
eval(snippet)
62
+
```
63
+
64
+
## Why this package?
65
+
The concept of analytics.js is awesome. **BUT Segments's free tier (max 1.000 monthly users) might not work for you**, if you have a lot of non-paying visitors on your website.
66
+
67
+
So if you want an **easy-to-configure**`analytics.js`-wrapper for your analytics (**Google Analytics, Mixpanel, Hotjar, YouNameIt, ...**), then this is your go-to! Basically **ALL big analytics-integrations are supported**.
68
+
69
+
**This solution is open source, unlimited and free forever!**
70
+
71
+
*Background (state 2018-10-24): Segment.com has aggressive pay-or-leave policies, which they will apply after you hit the 1000 free monthly users limit. They will lock your account and stop processing your events after a deadline.*
72
+
73
+
## WHY using this?
74
+
75
+
Advantages:
76
+
* You will NOT run out of segments free tier after hitting 1000 MPU (monthly users), because you simply do NOT use it
77
+
* You'll have a single API for tracking analytics (p.e. `analytics.page()` or `analytics.track()`)
78
+
79
+
Disadvantages:
80
+
* This does NOT work on server-side
81
+
* It might take a bit more time to configure than using segment
82
+
* You do NOT any of segments other cool features (which you will not need when starting a side-project)
83
+
84
+
## Question: What analytics-services are supported?
85
+
You should be able to use ALL services that segment itself supports and has integrations available. You'll have to dig around a bit in segment's code to find the options for each individual tool.
86
+
87
+
Check out the supported Integrations (that can be loaded via analytics.js) at https://github.com/segment-integrations.
88
+
89
+
## Credits
90
+
91
+
This is project is based on https://gist.github.com/typpo/5e2e4403c60314e04e8b6b257555f6de
92
+
and the related blogpost at http://www.ianww.com/blog/2017/08/06/analytics-js-standalone-library/.
93
+
94
+
## Contribute (Development notes)
95
+
96
+
CLI cheatsheat:
97
+
98
+
```
99
+
npm run build-watch; # auto-compile on file-change from /src to / via babel
0 commit comments