SDK

Instructions to implement the SDK to track off-chain dApp data.

Configuring SDK is essential for unlocking and collecting the off-chain data generated on your dApp. Configuring SDK will unlock data points like:

  • Wallet connections and all associated sessions data,

  • Funnel,

  • Wallet journey,

  • Interacting wallets,

  • Extracting wallets,

  • Wallet application types like MetaMask, WalletConnect, etc.,

  • And much more.

Overview

You can use the Spock Analytics' javascript package to keep track of the off-chain data in your dApp. It is easy to install as an npm package and will give you valuable off-chain insights into how your dApp is performing.

Installation

This package is available as a package on npm (named analytics-web3). Use the following to install into a project through npm/yarn.

npm install --save analytics-web3

Initialization

You will need an app key for initializing your package. You can get this app key from the app configuration page. Import the package like a standard Node.js module on the root of your project code and initialize it with your app key.

import Web3Analytics from 'analytics-web3';

// Enabling the debug mode flag is useful during implementation,
// but it's recommended to remove it for production
Web3Analytics.init({ appKey: 'YOUR APP KEY', debug: true });

// pass your web3 provider for web3 data tracking
Web3Analytics.walletProvider(window.ethereum);

SDK contains further tracking options which are covered in Full API Reference

Data Points:

The Spock Analytics SDK offers a completely customizable solution that can be seamlessly integrated into Spock Analytics. This SDK is composed of six major modules, which collectively allow you to comprehensively track various aspects within your dApp. These modules provide a high degree of flexibility, enabling you to tailor your analytics to precisely match your needs:

  1. Web3 Data: Obtain detailed insights on off-chain data while interacting with your dApp.

  2. Demographics: Capture demographic information about your users to gain a better understanding of your audience.

  3. Browser Profile: Analyze user behavior and preferences to enhance the user experience.

  4. Navigation: Monitor and assess a range of metrics related to your website, such as outbound links, page visits, and page views.

  5. UTM Parameters: Track the effectiveness of marketing campaigns by capturing UTM parameters from incoming traffic.

  6. Engagement: Quantify the performance of your campaign, gauging its effectiveness and return on investment (ROI).

By utilizing these customizable modules, you can create an analytics framework that aligns precisely with your specific requirements. This empowers you to gather insights, make informed decisions, and enhance the overall performance and user experience of your dApp.

Category
Data Points

Web3

Wallet Address, Chain ID, Wallet Type, Wallet Connection, Max Gas Fee, Quoted Gas Fee, Transaction Hash, Transaction Status, Submitted and Rejected Transaction Count and Failed Transactions.

Browser Profile

Current URL, Operating System, Browser, Referrer, Device, Referring Domain, Screen Width, Screen height, and Search Engine.

Demographics

Country,City and Region.

Navigation

Page Views and External Links.

UTM Params

UTM Campaign, UTM Content, UTM Medium, UTM Source and UTM Term.

Each of these modules empowers you to track various aspects of your dApp's performance and user interactions.

Privacy-Driven Integration: Empowerment and Control

Taking into account that identity and privacy are significant considerations for users when integrating an SDK into their dApp, especially in the context of Web3 ethos, Spock Analytics provides the flexibility for users to opt out of data tracking points within the SDK. Instead, users can simply copy a straightforward code snippet into their React app to initiate tracking of their chosen data. During the integration of the SDK, it's mandatory to incorporate web3 control, as this empowers Spock Analytics to effectively interpret and contextualize your data on the Spock Analytics dashboard.

The Spock Analytics SDK encompasses the following key modules:

  1. Web3 Data

  2. Browser Profile.

  3. Demographics.

  4. Page / Website.

  5. UTM Params.

  6. Engage (Coming Soon).

These modules collaboratively provide in-depth insights for data tracking, ensuring that you can comprehensively monitor and optimize your dApp's performance and user experience.

SDK User Privacy Features

Spock Analytics' SDK offers user privacy features that allow users to opt out of certain tracking options.

It is the responsibility of the dApp creators to make sure that they have user's consent before tracking the data.

User Privacy :

Ensuring user privacy is a fundamental principle within the Web3 ethos. As your dApp attracts users with various intentions, it is crucial to address their concerns regarding privacy. To address these concerns, Spock Analytics recommends initializing the SDK with passing optOut:true and then ask user consent for tracking, if he agrees to execute Web3Analytics.optInTracking(). Through this approach, you can prioritize user consent when it comes to collecting their off-chain data.

The Spock SDK provides the capability to collect data, but it operates in a privacy-conscious manner. If a user rejects or opts out of data tracking, the SDK will refrain from monitoring off-chain data associated with that specific user. However, you will still have the ability to analyze the user's on-chain behavior.

By emphasizing user privacy as our foremost priority, Spock Analytics, as a web3 analytics product, ensures that users can confidently engage with your dApp, knowing that their personal information and data remain protected.

Verify Installation

Head back to Spock Analytics to check the SDK status on the configurations page.

Once data hits our API, it generally takes ~60 seconds for it to be processed, stored, and queryable in your application.

If the data is not being fetched. Reload your dApp 1-2 times for the SDK to fire up properly.

FAQs

1. Is Spock Analytics reliant on third-party cookies?

No Spock Analytics doesn't use third-party cookies.

2. Does Spock Analytics provide an SDK for iOS or Android dApps?

Currently, Spock only has one SDK available, which can be integrated to track web-based events.

3. Can the Spock SDK be integrated with wallet extensions like MetaMask, and WalletConnect?

No, the Spock SDK is not compatible with tracking data for applications that are specifically related to wallet types.

Need Help? Contact Our Team

If you are stuck anywhere or have a suggestion or feedback, you can fill out the form here, or reach out to our team at support@spockanalytics.xyz.

Last updated