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.
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.
SDK contains further tracking options which are covered in
DApp Specific Initialization & Tracking
The SDK is completely customizable and allows users to track the specific data they want within their dApp. Currently, the full SDK offers the capability to monitor six different data points in your dApp. However, the choice of what type of tracking to implement in the dApp is entirely up to the user. Notably, the web3 data point is mandatory when integrating the most basic version of the SDK.
Currently, the SDK enables three major products:
Explore.
Probe.
Engage.
To leverage Spock Analytics' 'Explore and Probe' offering, ensure that you activate these specific data points within your dApp.
Web3 Data.
Usage Data (Web2).
Demographics.
Engage
Engage empowers you to interact directly with your users, bridging the gap between your decentralized application and its audience. With the ability to engage through in-app messaging, you're equipped to efficiently acquire new users and create lasting relationships that drive growth.
Engage provides functionality for audience creation and campaign building within your dApp, allowing users to present offers through in-app pop-ups or Twitter messaging.
To create and monitor your campaign effectively, it is essential to activate the following data points within your dApp.
Web3.
Engage.
Usage (Web2).
Demographics.
Point to be Noted:
web3
is the essential data point for all products as it enables the tracking of wallet connections.
SDK Tracked Data Metrics:
The 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:
Web3 Data: Obtain detailed insights on off-chain data while interacting with your dApp.
Usage Data(Web2): Capture comprehensive data on both web2 and bridged web2-web3 interactions, encompassing user navigation, browser details, operating system information, outbound links, referring domains, and UTM campaigns within the application.
Demographics: Capture demographic information about your users to gain a better understanding of your audience.
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.
Explore & Probe:
To unlock, activate, and enable all components within the Explore & Probe, you just need to allow the following data points for the Spock SDK to track, providing better and more detailed analytics for your decentralized application (dApp).
Web3 (Mandatory)
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.
Usage Data (Web2)
App Visit, Page View, User ID, Last Seen, Session Duration, Current URL, Operating System, Brower, Referrer, Referring Domain, External Links, Device, Screen Height, Screen Width, Search Engine, Outbound Link, Init. Referrer, Init. Referring Domain, UTM Campaigns, UTM Content, UTM Medium, UTM Source, and UTM Term.
Demographics
Country,City and Region.
Engage
Dialog Clicks, Click Through Rate (CTR), Transaction Through Rate (TTR), Dialogs Served, and Dialogs Closed.
Engage:
To monitor activities in your campaigns, simply activate the specified data points within Engage in.
Web3 (Mandatory)
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.
Engage (Mandatory)
Dialog Clicks, Click Through Rate (CTR), Transaction Through Rate (TTR), Dialogs Served, and Dialogs Closed.
Usage Data (Web2)
App Visit, Page View, User ID, Last Seen, Session Duration, Current URL, Operating System, Brower, Referrer, Referring Domain, External Links, Device, Screen Height, Screen Width, Search Engine, Outbound Link, Init. Referrer, Init. Referring Domain, UTM Campaigns, UTM Content, UTM Medium, UTM Source, and UTM Term.
Demographics
Country,City and Region.
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 asking for 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 be able 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.
4. Why Web3 Data point is mandatory in SDK?
SDK monitors and logs wallet-related data, including behavior and activity within your dApp. Without tracking web3 datapoint, the resulting data may lack clarity and prove challenging to analyze in terms of user activity and behavior.
To gain a complete understanding of both off-chain and on-chain data, it's necessary to enable web3 datapoint. Otherwise, while the data can still be displayed on the dashboard, it won't provide valuable insights within any of the metrics on the Spock dashboard.
5. Is the Spock SDK closed-source or open-source?
To ensure transparency and provide full access, Spock has made the SDK code public. Check out the open-source code here.
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