Spotify Ads Event Tracking | OpsBlu Docs

Spotify Ads Event Tracking

How to configure conversion tracking events for Spotify Ads. Covers pixel event setup, custom parameters, conversion value assignment, audience building.

Standard Events

Spotify Pixel supports these standard events:

PageView

Automatically fired by base code:

spotify('track', 'PageView');

Purchase

Track completed purchases:

spotify('track', 'Purchase', {
  value: 99.99,
  currency: 'USD',
  order_id: 'ORDER_12345',
  product_ids: ['SKU_12345', 'SKU_67890'],
  num_items: 2
});

Lead

Track lead generation:

spotify('track', 'Lead', {
  lead_type: 'contact_form',
  value: 50.00,
  industry: 'technology',
  company_size: '50-200'
});

SignUp

Track user registrations:

spotify('track', 'SignUp', {
  signup_method: 'email',
  subscription_tier: 'premium',
  trial_period: true
});

AddToCart

Track cart additions:

spotify('track', 'AddToCart', {
  product_id: 'SKU_12345',
  value: 49.99,
  currency: 'USD',
  quantity: 1
});

Custom Events

Content Engagement

spotify('track', 'CustomEvent', {
  event_name: 'content_engagement',
  content_type: 'blog_post',
  content_id: 'ARTICLE_789',
  time_spent: 120
});

Video Completion

spotify('track', 'CustomEvent', {
  event_name: 'video_complete',
  video_id: 'VIDEO_123',
  duration: 180,
  completion_rate: 100
});

Promo Code Redemption

spotify('track', 'CustomEvent', {
  event_name: 'promo_code_used',
  code: 'SPOTIFYSUMMER2024',
  discount_amount: 20.00,
  discount_type: 'percentage'
});

E-commerce Event Flow

// 1. View Product
spotify('track', 'ViewContent', {
  product_id: 'SKU_12345',
  value: 49.99
});

// 2. Add to Cart
spotify('track', 'AddToCart', {
  product_id: 'SKU_12345',
  value: 49.99,
  quantity: 1
});

// 3. Begin Checkout
spotify('track', 'CustomEvent', {
  event_name: 'begin_checkout',
  value: 54.99,
  currency: 'USD'
});

// 4. Purchase
spotify('track', 'Purchase', {
  value: 54.99,
  currency: 'USD',
  order_id: 'ORDER_12345',
  shipping: 5.00
});

Dynamic Event Tracking

Product View

function trackSpotifyProductView(product) {
  spotify('track', 'ViewContent', {
    product_id: product.id,
    product_name: product.name,
    category: product.category,
    value: product.price,
    currency: 'USD'
  });
}

// Usage
trackSpotifyProductView({
  id: 'SKU_12345',
  name: 'Blue Widget',
  category: 'widgets',
  price: 49.99
});

Form Submission

document.getElementById('contact-form').addEventListener('submit', function(e) {
  spotify('track', 'Lead', {
    lead_type: 'contact_form',
    form_location: 'homepage',
    value: 50.00
  });
});

Promo Code Attribution

Track Code Entry

function trackPromoCodeEntry(code) {
  // Validate it's a Spotify promo code
  if (code.toUpperCase().startsWith('SPOTIFY')) {
    spotify('track', 'CustomEvent', {
      event_name: 'promo_code_entered',
      code: code.toUpperCase(),
      source: 'spotify_audio_ad'
    });

    // Store attribution
    sessionStorage.setItem('spotify_promo_code', code.toUpperCase());
  }
}

// Integrate with checkout
document.getElementById('promo-code-field').addEventListener('blur', function(e) {
  trackPromoCodeEntry(e.target.value);
});

Attribute Purchase to Promo Code

function trackPurchaseWithPromoCode(orderData) {
  const promoCode = sessionStorage.getItem('spotify_promo_code');

  spotify('track', 'Purchase', {
    value: orderData.value,
    currency: 'USD',
    order_id: orderData.orderId,
    promo_code: promoCode || null,
    attributed_to: promoCode ? 'spotify_audio_ad' : null
  });

  // Clear after use
  sessionStorage.removeItem('spotify_promo_code');
}

GTM Implementation

Data Layer Push

dataLayer.push({
  'event': 'spotify_purchase',
  'ecommerce': {
    'purchase': {
      'actionField': {
        'id': 'ORDER_12345',
        'revenue': '99.99'
      }
    }
  }
});

GTM Tag

<script>
spotify('track', 'Purchase', {
  value: {{DLV - Transaction Value}},
  currency: 'USD',
  order_id: {{DLV - Transaction ID}}
});
</script>

Trigger: Custom Event - spotify_purchase

Best Practices

  • Include value and currency for all conversion events
  • Use unique order IDs to prevent duplicate tracking
  • Track promo code entry and redemption separately
  • Test events before launching campaigns
  • Monitor event volume in Ad Studio
  • Document event schema for team
  • Implement deduplication for hybrid tracking