Skip to content

Commit b2fefd0

Browse files
Merge remote-tracking branch 'origin/main'
2 parents d508ca0 + 194fcd6 commit b2fefd0

10 files changed

Lines changed: 325 additions & 9 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
slug: introducing-juno-analytics-unlock-deeper-insights-with-privacy-in-mind
3+
title: Introducing Juno Analytics - Unlock Deeper Insights with Privacy in Mind
4+
authors: [peterpeterparker]
5+
tags: [dapp, web3, analytics, opensource]
6+
image: https://juno.build/assets/images/introducing-juno-analytics-unlock-deeper-insights-with-privacy-in-mind-fb4d97daf48952a39b95259bf8a7d369.png
7+
---
8+
9+
![](./introducing-juno-analytics-unlock-deeper-insights-with-privacy-in-mind.png)
10+
11+
---
12+
13+
We're excited to introduce [Juno Analytics](../../docs/build/analytics), a simple, performant, and open-source web3 analytics solution designed with privacy in mind for the developers building decentralized dapps with Juno.
14+
15+
In a digital age where data privacy is paramount, Juno Analytics empowers you to gather valuable insights about your users while ensuring anonymity and respecting their privacy.
16+
17+
Here's a closer look at this powerful new feature:
18+
19+
---
20+
21+
## Privacy-Friendly Analytics
22+
23+
Juno Analytics is part of our commitment to user privacy. It conducts measurements of your dapps and sites completely anonymously, without using cookies or collecting any personal data.
24+
25+
This means no more intrusive cookie banners, no persistent identifiers, no cross-site tracking, and no cross-device tracking.
26+
27+
Your analytics data remains solely focused on providing you valuable insights without any other ulterior motives.
28+
29+
---
30+
31+
## Performance-Optimized Script
32+
33+
Our JavaScript library for gathering analytics is designed for peak performance. It consists of a minimal main script that seamlessly integrates with your application's user interface and a dedicated worker responsible for handling logic and cryptography.
34+
35+
This thoughtful design ensures that adding analytics won't slow down your application, even during boot time, preserving your customer acquisition rate.
36+
37+
---
38+
39+
## Comprehensive Tracking
40+
41+
With Juno Analytics, you're not limited to just basic page views. You can gain deeper insights into your visitors by creating custom events to track conversions, attributions, and more. It's a powerful tool for optimizing your dapps and sites.
42+
43+
---
44+
45+
## Fully Open Source
46+
47+
Juno is fully committed to the principles of open-source development. Unlike proprietary tools like Google Analytics, Juno Analytics is built with a commitment to transparency and freedom.
48+
49+
---
50+
51+
## You Own Your Data
52+
53+
All data tracked by our analytics solution is securely stored on the blockchain. As with all our services, you have full control over your smart contracts, and your data remains exclusively yours.
54+
55+
---
56+
57+
## Getting Started
58+
59+
To begin using Juno Analytics, please refer to our detailed documentation for [step-by-step instructions](/docs/build/analytics#getting-started).
60+
61+
It will guide you through the process of setting up and integrating Analytics into your websites and dapps. 🚀
62+
63+
---
64+
65+
## Conclusion
66+
67+
We hope you're as excited about Juno Analytics as we are! This feature marks a significant stride toward a more privacy-conscious analytics solution and provide Juno's developers an additional feature in the eco-system to build awesome decentralized applications.
68+
69+
👋
70+
71+
Stay connected with Juno by following us on [Twitter](https://twitter.com/junobuild).
72+
73+
⭐️⭐️⭐️ stars are also much appreciated: visit the [GitHub repo](https://github.com/buildwithjuno/juno) and show your support!
Loading

docs/build/analytics.md

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
---
2+
sidebar_position: 5
3+
---
4+
5+
# Analytics
6+
7+
Juno Analytics, a simple, performant, and open-source web3 analytics solution that respects your users' privacy and doesn't use cookies, ensuring anonymity while providing valuable user insights.
8+
9+
![Juno's Analytics screenshot](../img/analytics.webp)
10+
11+
## Features
12+
13+
Juno Analytics offers several advantages for developers:
14+
15+
### No cookie banners required
16+
17+
Just like all of Juno's features, Analytics prioritizes privacy. It conducts dapp and site measurements entirely anonymously, without using cookies or collecting personal data. There are no persistent identifiers, cross-site tracking, or cross-device tracking. Your analytics data is not used for any other purposes.
18+
19+
### Performance-Optimized Script
20+
21+
Juno's JavaScript library for statistics is optimized for performance. It consists of a minimal main script that seamlessly integrates with your application's UI and a dedicated worker responsible for handling logic and cryptography. This design ensures that adding analytics won't impact your application's performance, including its boot time, and per extension preserving your customer acquisition rate.
22+
23+
### Track goal conversions and campaigns
24+
25+
Beyond standard page views, you can gain valuable insights into your visitors by creating custom events to track conversions and attribution.
26+
27+
### Transparent and fully open source
28+
29+
Juno is fully open source, including all its Analytics features, setting it apart from proprietary tools like Google Analytics.
30+
31+
Furthermore, unlike any other analytics alternative or solution, Juno's long-term vision is to evolve into a decentralized organization (DAO), embracing a new paradigm in the analytics industry.
32+
33+
## Considerations
34+
35+
In deploying Juno Analytics, it's important to understand various aspects that can affect its use and compliance.
36+
37+
### GDPR and PECR compliance
38+
39+
Juno Analytics refrains from generating persistent identifiers. Temporary anonymous data is stored in IndexedDB until it is synchronized with the smart contract. It employs a random unique string to calculate unique visitor sessions on a website with each new visit.
40+
41+
While we are not legal experts and the responsibility for adding analytics to your project ultimately rests with you, the above approach aligns our analytics with various cookie laws and privacy regulations, including GDPR and PECR.
42+
43+
### Hosted on the blockchain
44+
45+
All tracked data is securely stored on the blockchain without any specific geolocation. Currently, Analytics is not guaranteed to be located in Europe.
46+
47+
### No cross-dapp tracking
48+
49+
Juno Analytics does not follow users across websites and applications they visit. All data remains isolated to a single satellite.
50+
51+
### You 100% own your data
52+
53+
As with all services provided by Juno, you are the sole controller of your smart contracts, and your data belongs exclusively to you.
54+
55+
You have the capability to delete all collected data within your Analytics at any time by utilizing the [CLI] to reset your smart contract.
56+
57+
## How does it work?
58+
59+
To gather analytics for your dapps, you need to create an [orbiter]. Creating an Orbiter requires ICP, and its price is defined in the [transaction costs](../pricing#transaction-costs).
60+
61+
Each orbiter is used to collect analytics for one or multiple [satellites].
62+
63+
Page views are collected anonymously and saved with a unique random ID for attribution. This data is organized based on its collection timestamp.
64+
65+
You can also collect custom tracking events, which are organized in the same manner.
66+
67+
Additionally, a unique random session ID is generated for all data. Each time a visitor visits your dapps, a new session is created.
68+
69+
## Limitation
70+
71+
Currently, an orbiter can store up to 96GB of data.
72+
73+
:::caution
74+
75+
Similar to other analytics services in the Web2 environment, an Orbiter accepts data submitted from any source as long as the requested payload matches the expected format, and the targeted satellite is configured to accept analytics. This is because the origin of the HTTP request cannot be accessed, for a valid reason – to prevent tracking. Therefore, calls cannot be limited to the domain of your dapps.
76+
77+
Consequently, this leaves the canister open to potential attacks that can pollute the data and consume cycles. For this reason, we recommend the following:
78+
79+
1. Avoid topping up the smart contract with excessive cycles; instead, adopt a lean approach.
80+
2. Utilize the [monitoring](../miscellaneous/monitoring.md) feature to stay informed about the status.
81+
3. Interpret the statistics provided by this feature with some reservation, similar to any other analytics data, considering potential inaccuracies.
82+
83+
:::
84+
85+
## Getting started
86+
87+
Before integrating Juno Analytics into your app or website, you need to create an orbiter. Here's a step-by-step guide to help you get started:
88+
89+
1. Sign in to the Juno [console](https://console.juno.build).
90+
2. Navigate to "Analytics" in the astronaut entry menu at the top right of your screen.
91+
3. Click on **Get started**
92+
4. Confirm by selecting **Create analytics**
93+
94+
The platform will then create your orbiter smart contract and provision its resources. Once the process is complete, click "Close" to terminate the creation wizard.
95+
96+
At this point, you have successfully created the analytics; however, you have not yet listed which satellites are eligible to track page views and events. To complete the configuration, proceed to the **Settings** page to register them.
97+
98+
## Install the SDK and initialize the Orbiter
99+
100+
To start using Juno Analytics, follow these steps:
101+
102+
1. Install Juno's analytics library using npm:
103+
104+
```bash
105+
npm i @junobuild/analytics
106+
```
107+
108+
2. Initialize the orbiter in your web app or website:
109+
110+
```typescript
111+
import { initOrbiter } from "@junobuild/analytics";
112+
113+
// TODO: Replace the following satelliteId and orbiterId with the effective ID.
114+
await initOrbiter({
115+
satelliteId: "aaaaa-bbbbb-ccccc-ddddd-cai",
116+
orbiterId: "eeeee-fffff-ddddd-11111-cai",
117+
});
118+
```
119+
120+
3. Copy the pre-packaged web worker provided by the library to your `public` or `static` folder, where your project's static assets are located.
121+
122+
- You can achieve this by adding a post-install script to your `package.json`. Here's an example of an inline command:
123+
124+
```json
125+
{
126+
"scripts": {
127+
"postinstall": "node -e \"require('fs').cpSync('node_modules/@junobuild/analytics/dist/workers/', './static/workers', {recursive: true});\""
128+
}
129+
}
130+
```
131+
132+
- Alternatively, you can create a script, e.g., `copy-juno-workers.mjs`, at the root of your project with the following code:
133+
134+
```js
135+
import { cp } from "node:fs";
136+
import { extname } from "node:path";
137+
138+
await cp(
139+
"node_modules/@junobuild/analytics/dist/workers/",
140+
"./static/workers",
141+
{
142+
recursive: true,
143+
},
144+
(err) => {
145+
if (err === null) {
146+
return;
147+
}
148+
149+
console.error(err);
150+
}
151+
);
152+
```
153+
154+
Finally, add a command to your `package.json` that executes the script:
155+
156+
```json
157+
{
158+
"scripts": {
159+
"postinstall": "node ./scripts/copy-juno-workers.mjs"
160+
}
161+
}
162+
```
163+
164+
Once configured, run `npm run postinstall` manually to trigger the initial copy. Every time you run `npm ci`, the post-install target will execute, ensuring the worker is copied.
165+
166+
:::info
167+
168+
- The above example assumes that `/static` is the folder holding your static assets (e.g., images, favicons, etc.). Adjust the path according to your application.
169+
170+
- If you prefer to specify a custom path for the worker, you can use the `initOrbiter` function with the additional parameter `{worker?: {path?: string}}` for this purpose.
171+
172+
:::
173+
174+
## Page views
175+
176+
Page views, such as when a visitor opens your website or navigates to a subpage, are automatically tracked once you have configured, initialized, and deployed your application with the analytics module.
177+
178+
There's **no need** for additional development work!
179+
180+
## Track custom events
181+
182+
Custom events can be tracked using the `trackEvent` function. You need to provide a `name` for the event, and you can include up to 10 custom `metadata` fields.
183+
184+
:::note
185+
186+
This is an option. As explained in the previous chapter, the library will take care of gathering insightful anonymous data as soon as it is configured and initialized.
187+
188+
Custom events are useful if you want to take an extra step and collect your own specific information.
189+
190+
:::
191+
192+
Here's an example of how to use it:
193+
194+
```javascript
195+
import { trackEvent } from "@junobuild/analytics";
196+
197+
await trackEvent({
198+
name: "Your custom event",
199+
metadata: {
200+
your_key: "A value",
201+
your_other_key: "Another value",
202+
},
203+
});
204+
```
205+
206+
This allows you to track specific events and gather data relevant to your application.
207+
208+
:::note
209+
210+
For scalability and optimization reasons, the data collected must adhere to certain rules, particularly regarding their length. For instance, a randomly generated key should not exceed 36 bytes in length.
211+
212+
For detailed information about these rules, please refer to Juno's GitHub [repository](https://github.com/buildwithjuno/juno).
213+
214+
:::
215+
216+
[CLI]: ../miscellaneous/cli.md
217+
[satellites]: ../terminology.md#satellite
218+
[orbiter]: ../terminology.md#orbiter
219+
[controllers]: ../terminology.md#controller

docs/img/analytics.webp

55.8 KB
Loading

docs/pricing.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,32 @@ sidebar_position: 11
66

77
There are two types of costs associated with using Juno.
88

9-
1. Operating costs for your [mission control] or satellites
9+
1. Operating costs for your [mission control], satellites and orbiters
1010
2. Costs for executing transactions with Juno
1111

1212
:::note
1313

14-
Last update: June 15, 2023
14+
Last update: Sept. 17, 2023
1515

1616
:::
1717

1818
## Operating costs
1919

20-
As the owner of your mission control or satellites, you are responsible for their operating costs.
20+
As the owner of your mission control, satellites and orbiters, you are responsible for their operating costs.
2121

2222
To ensure that your infrastructure usage is covered, you must maintain a minimum balance of [cycles](terminology.md#cycles).
2323

2424
You can top up your cycle balance in the Juno [console](https://console.build.com) using ICP from your mission control or from anywhere else on the [Internet Computer](https://internetcomputer.org/).
2525

2626
## Transaction costs
2727

28-
New developers joining Juno are given credits to create a mission control and their first [satellite].
28+
New developers who join Juno are granted credits to create a mission control and their initial [satellite].
2929

30-
To create additional satellites, a fee of 0.5 ICP is required, in addition to the costs required by the infrastructure to create the smart contract.
30+
To create additional satellites, a fee of 0.5 ICP is necessary, along with the infrastructure costs for setting up the smart contract.
3131

32-
Please note that further transaction fees may be required in the future and prices and models are subject to change.
32+
Similarly, enabling analytics by creating an [orbiter] entails a fee of 0.5 ICP, plus the infrastructure costs for creating the smart contract.
33+
34+
Please note that additional transaction fees may be introduced in the future, and pricing and models are subject to change.
3335

3436
## Cost examples
3537

@@ -69,3 +71,4 @@ You are the owner of your mission control, and Juno has no control or access to
6971

7072
[mission control]: terminology.md#mission-control
7173
[satellite]: terminology.md#satellite
74+
[orbiter]: terminology.md#orbiter

docs/roadmap.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ We have big plans for the near and distant future.
1010

1111
Our goal is to continue delivering features that seamlessly integrate both web3 and web2 worlds, while ensuring ease of development. This includes:
1212

13-
- Analytics
1413
- Plug-and-play recurring payment and paywall solutions
1514
- Handing over [mission control] or [satellite] to DAO SNS (Service Nervous Systems)
1615

@@ -29,7 +28,7 @@ While Juno is currently focused on individual developers, we recognize the impor
2928
To support growth and foster new ideas, we aim to make various infrastructure improvements, including:
3029

3130
- Upgrading satellites overall available memory, starting with 64 GB
32-
- Enabling the implementation of backend functions in response to events triggered in satellites
31+
- Enabling the implementation of backend functions ("serverless functions") in response to events triggered in satellites
3332
- Replacing quick queries with certified calls by default
3433
- Automatically topping up mission control and satellites
3534
- Providing real-time data updates

docs/terminology.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ For a schematic representation, refer to the [Architecture](./architecture.md) d
5252

5353
[NFID](https://nfid.one) is a digital identity that provides private and secure sign-in to applications. It offers a convenient way to authenticate with third-party providers like [Metamask](https://metamask.io/) and [Google](https://www.google.com/account/about/).
5454

55+
## Orbiter
56+
57+
An orbiter is the term we use to refer to the smart contract that can optionally be employed for analytics to gather valuable, anonymous insights about your users.
58+
5559
## Principal
5660

5761
Principals are generic identifiers for the [console], [mission controls], [satellites], and users.

src/components/Features/index.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Authentication from "@site/static/icons/authentication.svg";
66
import Datastore from "@site/static/icons/datastore.svg";
77
import Storage from "@site/static/icons/storage.svg";
88
import Hosting from "@site/static/icons/hosting.svg";
9+
import Analytics from "@site/static/icons/analytics.svg";
910

1011
export default function Features(): JSX.Element {
1112
return (
@@ -57,6 +58,17 @@ export default function Features(): JSX.Element {
5758
}
5859
icon={<Hosting />}
5960
/>
61+
62+
<Feature
63+
title="Analytics"
64+
text="Gather valuable, anonymous user insights with a simple, lightweight, and open-source web analytics that do not use cookies."
65+
link={
66+
<Link to="/docs/build/analytics" className={styles.link}>
67+
Learn more
68+
</Link>
69+
}
70+
icon={<Analytics />}
71+
/>
6072
</div>
6173
</>
6274
);

0 commit comments

Comments
 (0)