Skip to content

Amplitude

Amplitude is a product analytics platform that helps you understand user behavior and drive product growth through data-driven insights.

Overview

Amplitude provides powerful product analytics capabilities. Integrating Sesamy with Amplitude allows you to track subscription events, analyze user journeys, and optimize your subscription funnel.

Features

  • Event tracking - Track all subscription-related events
  • User properties - Set subscription status as user properties
  • Funnel analysis - Analyze subscription conversion funnels
  • Cohort analysis - Group users by subscription behavior
  • Retention tracking - Monitor subscriber retention over time
  • Revenue analytics - Track subscription revenue and LTV

Integration Methods

Via JavaScript SDK

Integrate Amplitude tracking with Sesamy events:

html
<script src="https://cdn.amplitude.com/libs/amplitude-8.21.4-min.gz.js"></script>
<script>
  amplitude.getInstance().init("YOUR_API_KEY");

  // Track paywall events
  window.addEventListener('sesamyPaywallAccessChecked', (event) => {
    amplitude.getInstance().logEvent('Paywall Access Checked', {
      hasAccess: event.detail.hasAccess,
      paywallId: event.detail.paywallId,
      articleUrl: event.detail.articleUrl
    });
  });

  // Track subscription events
  window.addEventListener('sesamyPaywallProductSelected', (event) => {
    amplitude.getInstance().logEvent('Subscription Product Selected', {
      product: event.detail.product,
      checkoutId: event.detail.checkoutId,
      paywallId: event.detail.paywallId
    });
  });

  // Track content unlocks
  window.addEventListener('sesamyUnlocked', (event) => {
    amplitude.getInstance().logEvent('Content Unlocked', {
      itemSrc: event.detail.itemSrc,
      publisherContentId: event.detail.publisherContentId
    });
  });

  // Set user properties based on subscription status
  window.addEventListener('login', (event) => {
    const identify = new amplitude.Identify()
      .set('subscription_status', 'active')
      .set('subscriber', true);
    amplitude.getInstance().identify(identify);
  });
</script>

Via Server-Side API

Use Sesamy Webhooks with Amplitude's HTTP API:

javascript
// Example webhook handler
app.post('/sesamy-webhook', async (req, res) => {
  const event = req.body;
  
  await amplitude.track({
    event_type: 'Subscription Created',
    user_id: event.userId,
    event_properties: {
      subscriptionId: event.subscriptionId,
      plan: event.planId,
      amount: event.amount
    }
  });
  
  res.sendStatus(200);
});

Events to Track

Subscription Funnel Events

  • Paywall Viewed - User sees paywall
  • Paywall Dismissed - User closes paywall without subscribing
  • Product Selected - User selects subscription product
  • Checkout Started - User begins checkout process
  • Subscription Completed - Subscription successfully created

Content Events

  • Content Viewed - User views content (preview or full)
  • Content Unlocked - Premium content accessed
  • Paywall Conversion - User subscribed after seeing paywall

User Properties

  • subscription_status - active, cancelled, expired
  • subscription_tier - free, premium, etc.
  • subscription_start_date - When subscription began
  • is_subscriber - Boolean flag

Use Cases

  • Analyze paywall conversion funnel to identify drop-off points
  • Track user journey from content discovery to subscription
  • Measure impact of pricing changes on conversion
  • Identify high-value content that drives subscriptions
  • Monitor subscriber retention and churn patterns
  • Perform A/B testing on paywall designs

Resources

Released under the MIT License.