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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@23blocks/block-campaigns

v3.1.1

Published

Campaigns block for 23blocks SDK - marketing campaigns, media, landing pages, and audience management

Readme

@23blocks/block-campaigns

Campaigns block for the 23blocks SDK - marketing campaigns, media, landing pages, and audiences.

npm version License: MIT

Installation

npm install @23blocks/block-campaigns @23blocks/transport-http

Overview

This package provides marketing campaign functionality including:

  • Campaigns - Campaign management and tracking
  • Campaign Media - Media assets for campaigns
  • Landing Pages - Landing page management
  • Audiences - Target audience management

Quick Start

import { createHttpTransport } from '@23blocks/transport-http';
import { createCampaignsBlock } from '@23blocks/block-campaigns';

const transport = createHttpTransport({
  baseUrl: 'https://api.yourapp.com',
  headers: () => {
    const token = localStorage.getItem('access_token');
    return token ? { Authorization: `Bearer ${token}` } : {};
  },
});

const campaigns = createCampaignsBlock(transport, {
  apiKey: 'your-api-key',
});

// List active campaigns
const { data: campaignList } = await campaigns.campaigns.list({
  status: 'active',
  limit: 20,
});

campaignList.forEach((campaign) => {
  console.log(campaign.name, campaign.startDate, campaign.endDate);
});

Services

campaigns - Campaign Management

// List campaigns
const { data: campaignList } = await campaigns.campaigns.list({
  limit: 20,
  status: 'active',
});

// Get campaign by ID
const campaign = await campaigns.campaigns.get('campaign-id');

// Create campaign
const newCampaign = await campaigns.campaigns.create({
  name: 'Summer Sale 2024',
  description: 'Annual summer promotion',
  type: 'promotion',
  startDate: '2024-06-01',
  endDate: '2024-08-31',
  budget: 10000,
  status: 'draft',
});

// Update campaign
await campaigns.campaigns.update('campaign-id', {
  status: 'active',
  budget: 15000,
});

// Delete campaign
await campaigns.campaigns.delete('campaign-id');

// Get campaign results
const results = await campaigns.campaigns.getResults('campaign-id');
console.log(results.impressions, results.clicks, results.conversions);

campaignMedia - Media Management

// List media for campaign
const { data: mediaList } = await campaigns.campaignMedia.list({
  campaignId: 'campaign-id',
});

// Get media by ID
const media = await campaigns.campaignMedia.get('media-id');

// Create campaign media
const newMedia = await campaigns.campaignMedia.create({
  campaignId: 'campaign-id',
  name: 'Banner Ad',
  type: 'image',
  fileId: 'file-id',
  placement: 'homepage_banner',
  status: 'active',
});

// Update media
await campaigns.campaignMedia.update('media-id', {
  status: 'paused',
});

// Delete media
await campaigns.campaignMedia.delete('media-id');

// Get media results
const results = await campaigns.campaignMedia.getResults('media-id');
console.log(results.impressions, results.clicks, results.ctr);

landingPages - Landing Page Management

// List landing pages
const { data: pages } = await campaigns.landingPages.list({
  campaignId: 'campaign-id',
});

// Get landing page by ID
const page = await campaigns.landingPages.get('page-id');

// Create landing page
const newPage = await campaigns.landingPages.create({
  campaignId: 'campaign-id',
  name: 'Summer Sale Landing',
  slug: 'summer-sale-2024',
  title: 'Summer Sale - Up to 50% Off',
  content: '<h1>Summer Sale</h1>...',
  status: 'published',
});

// Update landing page
await campaigns.landingPages.update('page-id', {
  content: '<h1>Updated Content</h1>...',
});

// Delete landing page
await campaigns.landingPages.delete('page-id');

audiences - Audience Management

// List audiences
const { data: audiences } = await campaigns.audiences.list();

// Get audience by ID
const audience = await campaigns.audiences.get('audience-id');

// Create audience
const newAudience = await campaigns.audiences.create({
  name: 'Premium Customers',
  description: 'Customers with lifetime value > $1000',
  criteria: {
    minLifetimeValue: 1000,
    segments: ['active', 'returning'],
  },
});

// Update audience
await campaigns.audiences.update('audience-id', {
  criteria: {
    minLifetimeValue: 1500,
  },
});

// Delete audience
await campaigns.audiences.delete('audience-id');

// Get audience members
const { data: members } = await campaigns.audiences.getMembers('audience-id', {
  limit: 100,
});

// Add member to audience
await campaigns.audiences.addMember('audience-id', {
  userId: 'user-id',
});

// Remove member from audience
await campaigns.audiences.removeMember('audience-id', 'member-id');

Types

import type {
  Campaign,
  CampaignResults,
  CampaignMedia,
  CampaignMediaResults,
  LandingPage,
  Audience,
  AudienceMember,
  CreateCampaignRequest,
  CreateCampaignMediaRequest,
  CreateLandingPageRequest,
  CreateAudienceRequest,
} from '@23blocks/block-campaigns';

Campaign

| Property | Type | Description | |----------|------|-------------| | id | string | Campaign ID | | name | string | Campaign name | | description | string | Campaign description | | type | string | Campaign type | | status | string | draft, active, paused, completed | | startDate | Date | Campaign start date | | endDate | Date | Campaign end date | | budget | number | Campaign budget |

CampaignResults

| Property | Type | Description | |----------|------|-------------| | impressions | number | Total impressions | | clicks | number | Total clicks | | conversions | number | Total conversions | | spend | number | Total spend | | revenue | number | Total revenue | | roi | number | Return on investment |

Related Packages

License

MIT - Copyright (c) 2024 23blocks