-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
license, readme, ci, and API defaults
- Loading branch information
1 parent
951f42c
commit 3f0e0b2
Showing
6 changed files
with
176 additions
and
191 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Hightouch | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
--- | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014 Hightouch, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,141 +1,149 @@ | ||
[![GitHub Actions](https://github.com/hightouchio/analytics-java/actions/workflows/java17.yml/badge.svg)](https://github.com/hightouchio/analytics-java/actions/workflows/java17.yml) [![codecov](https://codecov.io/gh/hightouchio/analytics-java/branch/master/graph/badge.svg?token=804hPfMd0C)](https://codecov.io/gh/hightouchio/analytics-java) | ||
# Events SDK Java | ||
|
||
# analytics-java | ||
This SDK is for general Java applications. However, for Android, please see [the android specific SDK](https://github.com/ht-sdks/events-sdk-android). | ||
|
||
analytics-java is a Java client for [Hightouch](https://hightouch.com) | ||
## Installation | ||
|
||
<div align="center"> | ||
<img src="https://user-images.githubusercontent.com/16131737/53616602-46c69d00-3b98-11e9-827d-741f8c6d3bf7.png"/> | ||
<p><b><i>You can't fix what you can't measure</i></b></p> | ||
</div> | ||
This SDK is available through [JitPack](https://jitpack.io/#ht-sdks/events-sdk-java/). | ||
|
||
Analytics helps you measure your users, product, and business. It unlocks insights into your app's funnel, core business metrics, and whether you have product-market fit. | ||
### Option A - Maven | ||
|
||
## How to get started | ||
Add to `pom.xml`: | ||
|
||
1. **Collect analytics data** from your app(s). | ||
- The top 200 Hightouch companies collect data from 5+ source types (web, mobile, server, CRM, etc.). | ||
2. **Send the data to analytics tools** (for example, Google Analytics, Amplitude, Mixpanel). | ||
- Over 250+ Hightouch companies send data to eight categories of destinations such as analytics tools, warehouses, email marketing and remarketing systems, session recording, and more. | ||
3. **Explore your data** by creating metrics (for example, new signups, retention cohorts, and revenue generation). | ||
- The best Hightouch companies use retention cohorts to measure product market fit. Netflix has 70% paid retention after 12 months, 30% after 7 years. | ||
|
||
[Hightouch](https://hightouch.com) collects analytics data and allows you to send it to more than 250 apps (such as Google Analytics, Mixpanel, Optimizely, Facebook Ads, Slack, Sentry) just by flipping a switch. You only need one Hightouch code snippet, and you can turn integrations on and off at will, with no additional code. [Sign up with Hightouch today](https://app.hightouch.com/signup). | ||
|
||
### Why? | ||
|
||
1. **Power all your analytics apps with the same data**. Instead of writing code to integrate all of your tools individually, send data to Hightouch, once. | ||
|
||
2. **Install tracking for the last time**. We're the last integration you'll ever need to write. You only need to instrument Hightouch once. Reduce all of your tracking code and advertising tags into a single set of API calls. | ||
|
||
3. **Send data from anywhere**. Send Hightouch data from any device, and we'll transform and send it on to any tool. | ||
|
||
4. **Query your data in SQL**. Slice, dice, and analyze your data in detail with Hightouch SQL. We'll transform and load your customer behavioral data directly from your apps into Amazon Redshift, Google BigQuery, or Postgres. Save weeks of engineering time by not having to invent your own data warehouse and ETL pipeline. | ||
|
||
For example, you can capture data on any app: | ||
|
||
```js | ||
analytics.track("Order Completed", { price: 99.84 }); | ||
``` | ||
|
||
Then, query the resulting data in SQL: | ||
|
||
```sql | ||
select * from app.order_completed | ||
order by price desc | ||
``` | ||
|
||
### 🚀 Startup Program | ||
|
||
<div align="center"> | ||
<a href="https://hightouch.com/startups"><img src="https://user-images.githubusercontent.com/16131737/53128952-08d3d400-351b-11e9-9730-7da35adda781.png" /></a> | ||
</div> | ||
If you are part of a new startup (<$5M raised, <2 years since founding), we just launched a new startup program for you. You can get a Hightouch Team plan (up to <b>$25,000 value</b> in Hightouch credits) for free up to 2 years — <a href="https://hightouch.com/startups/">apply here</a>! | ||
|
||
## Documentation | ||
|
||
Documentation is available at [https://hightouch.com/libraries/java](https://hightouch.com/libraries/java). | ||
|
||
_Add to `pom.xml`:_ | ||
```xml | ||
<repositories> | ||
<repository> | ||
<id>jitpack.io</id> | ||
<url>https://jitpack.io</url> | ||
</repository> | ||
</repositories> | ||
``` | ||
|
||
```xml | ||
<dependency> | ||
<groupId>com.hightouch.analytics.java</groupId> | ||
<groupId>com.github.ht-sdks.events-sdk-android</groupId> | ||
<artifactId>analytics</artifactId> | ||
<version>LATEST</version> | ||
</dependency> | ||
``` | ||
|
||
_or if you're using Gradle:_ | ||
### Option B - Gradle: | ||
|
||
```bash | ||
compile 'com.hightouch.analytics.java:analytics:+' | ||
1. Add JitPack to your build | ||
|
||
```gradle | ||
allprojects { | ||
repositories { | ||
... | ||
maven { url 'https://jitpack.io' } | ||
} | ||
} | ||
``` | ||
|
||
## Snapshots | ||
2. Add your dependendcy | ||
|
||
```gradle | ||
compile 'com.github.ht-sdks.events-sdk-java:analytics:+' | ||
``` | ||
|
||
All changes committed to master are automatically released as snapshots. | ||
## Usage | ||
|
||
To add a snapshot dependency to your builds, make sure you add the snapshot repository so your build system can look up the dependency. | ||
Create an instance of the Analytics object: | ||
|
||
Maven users can add the following to their `pom.xml`: | ||
```java | ||
import com.hightouch.analytics.Analytics; | ||
|
||
public class Main { | ||
public static void main(String... args) throws Exception { | ||
final Analytics analytics = | ||
Analytics.builder(WRITE_KEY) | ||
.endpoint(API_ENDPOINT) | ||
.build(); | ||
} | ||
} | ||
``` | ||
<repository> | ||
<id>ossrh</id> | ||
<name>Sonatype Snapshot Repository</name> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url> | ||
<releases> | ||
<enabled>false</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</repository> | ||
|
||
### Track | ||
|
||
```java | ||
analytics.enqueue(TrackMessage.builder("Item Purchased") | ||
.userId("f4ca124298") | ||
.properties(ImmutableMap.builder() | ||
.put("revenue", 39.95) | ||
.put("shipping", "2-day") | ||
.build() | ||
) | ||
); | ||
``` | ||
|
||
Gradle users should declare this in their repositories block: | ||
### Screen | ||
|
||
```java | ||
analytics.enqueue(ScreenMessage.builder("Schedule") | ||
.userId("f4ca124298") | ||
.properties(ImmutableMap.builder() | ||
.put("category", "Sports") | ||
.put("path", "/sports/schedule") | ||
.build() | ||
) | ||
); | ||
``` | ||
|
||
### Page | ||
|
||
```java | ||
analytics.enqueue(PageMessage.builder("Schedule") | ||
.userId("f4ca124298") | ||
.properties(ImmutableMap.builder() | ||
.put("category", "Sports") | ||
.put("path", "/sports/schedule") | ||
.build() | ||
) | ||
); | ||
``` | ||
repositories { | ||
mavenCentral() | ||
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } | ||
} | ||
|
||
### Identify | ||
|
||
```java | ||
Map<String, String> map = new HashMap(); | ||
map.put("name", "Michael Bolton"); | ||
map.put("email", "[email protected]"); | ||
|
||
analytics.enqueue(IdentifyMessage.builder() | ||
.userId("f4ca124298") | ||
.traits(map)); | ||
``` | ||
|
||
## License | ||
### Group | ||
|
||
```java | ||
analytics.enqueue(GroupMessage.builder("some-group-id") | ||
.userId("f4ca124298") | ||
.traits(ImmutableMap.builder() | ||
.put("name", "Segment") | ||
.put("size", 50) | ||
.build() | ||
) | ||
); | ||
``` | ||
|
||
### Alias | ||
|
||
```java | ||
analytics.enqueue(AliasMessage.builder("previousId") | ||
.userId("f4ca124298") | ||
); | ||
``` | ||
WWWWWW||WWWWWW | ||
W W W||W W W | ||
|| | ||
( OO )__________ | ||
/ | \ | ||
/o o| MIT \ | ||
\___/||_||__||_|| * | ||
|| || || || | ||
_||_|| _||_|| | ||
(__|__|(__|__| | ||
The MIT License (MIT) | ||
Copyright (c) 2014 Hightouch, Inc. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
### Context | ||
|
||
```java | ||
analytics.enqueue(TrackMessage.builder("Button Clicked") | ||
.userId("f4ca124298") | ||
.context(ImmutableMap.builder() | ||
.put("ip", "12.212.12.49") | ||
.put("language", "en-us") | ||
.build() | ||
) | ||
); | ||
``` |
Oops, something went wrong.