npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

blinksights-sdk

v1.0.19

Published

A simple SDK for seamlessly integrating blinksights analytics into your blinks.

Downloads

53

Readme

Solana Blink Analytics

A simple SDK for seamlessly integrating Blinksights analytics into Solana Blinks.

Usage

Before you start, make sure you have a Blinksights account and API key. You can create an account and API key at blinksights.xyz.

Install the Blinksights SDK

npm install blinksights-sdk

Import the Blinksights SDK

import { BlinksightsClient } from 'blinksights-sdk';

Create a new Blinksights client

const client = new BlinksightsClient('YOUR ACCESS TOKEN');

Track a render event in your GET request handler

You can create an ActionGetResponse object using the createActionGetResponseV1 method. By using this ActionGetResponse you will be able to track the performance of your Solana Blinks.

const payload: ActionGetResponse = client.createActionGetResponseV1(request.url, {
    "title": "Realms DAO Platform",
    "icon": "<url-to-image>",
    "description": "Vote on DAO governance proposals #1234.",
    "label": "Vote",
    links: {
        actions: [
            {
                "label": "Vote Yes", // button text
                "href": "/api/proposal/1234/vote?choice=yes"
            },
        ],
    },
});

return new Response(JSON.stringify(payload), {
    status: 200,
    headers: ACTIONS_CORS_HEADERS,
});

Track an interaction event in your POST request handler

The wallet will make a POST request with the payer's wallet address in the request body. You can access the request body using request.json() and then pass the payer's public key to as well as the Solana Blink URL to the trackActionV2 method.

// The payer's public key will be in the request body
const body = await request.json();

client.trackActionV2(account, request.url);

Track conversions

If you want to track the conversions of your Solana Blink, you need to include a memo instruction in the transactions so that we can search for the transactions on-chain and check its confirmation status. To do this, you can call the getActionIdentityInstructionV2 method along with the payer's public key and request URL. This function will return a transaction instruction that you can include in your transaction as follows:

// Call getActionIdentityInstructionV1 in your POST request handler
const blinksightsActionIdentityInstruction = client.getActionIdentityInstructionV2(account, request.url);

// Add the instruction to your transaction
const messageV0 = new TransactionMessage({
    payerKey: accountPubKey,
    recentBlockhash: blockhash,
    instructions: [
        //.. Your instructions
        blinksightsActionIdentityInstruction,
    ],
}).compileToV0Message(addressLookupTableAccounts);

Key Features

  • Track Solana Blink Views
  • Track Solana Blink Interactions
  • Track Solana Blink Conversions