Server-side GTM (ssGTM) Pixel Integration

Step-by-step guide to install the Spotify Pixel in your Server-side Google Tag Manager instance

Applies to: Brands and Agencies

Due to the nature of img pixels, Spotify Ad Analytics is unable to provide assistance with the QA or troubleshooting of an img pixel implementation.

Google's Server-side tagging (ssGTM) is a way to instrument your tags to measure user activity wherever it happens.

Before you begin:

For new clients without a Spotify Pixel:

For existing clients who already have a Spotify Pixel:

  • Navigate to Manage > Your Pixels and click onto your alpha-numeric Pixel ID. 

    • This will enable us to isolate the ssGTM traffic and ensure that it is consistent with the previous Javascript setup (if you were previously using Javascript).

    • We encourage you to replace all instances of the JS pixel with the ssGTM tracking to ensure consistency.  Failure to do so may lead to a drop in CR.

  • Follow all of the Setup Steps below.

  • After launch and verification, remove the Spotify JS pixel from all pages (if you were previously using Javascript). If the ssGTM pixel and the JS pixel both fire, we may count duplicate events which would artificially inflate CR.

Step 1


1. [REQUIRED] Construct your page view pixel URL:

https://img.byspotify.com?key={pixel_id}&a={action}&uid={session_id}&alias={alias}

Check out a completed page view example here: https://img.byspotify.com?key=123&a=init&uid=7375636365737340706f647369676874732e636f6d&alias=abc


Populate these values:
  • pixel_id

    • Copy the numeric value found on Manage > Your Pixels (example: key=123)

  • action

    • Defines the conversion event type: init (Page view), lead, or purchase (example: a=init)

  • session_id

    • A hashed session ID. This enables us to distinguish multiple events by the same visitor. (example: uid=7375636365737340706f647369676874732e636f6d)

  • alias

    • Your internal user ID for matching across subdomains (example: alias=abc)

2. [Optional] Construct your lead pixel URL:

https://img.byspotify.com?key={pixel_id}&a={action}&uid={session_id}&alias={alias}

Check out a completed lead example here: https://img.byspotify.com?key=123&a=lead&uid=7375636365737340706f647369676874732e636f6d&type=newsletter&value=signup

Populate these values:

  • pixel_id
    • Copy the numeric value found on Manage > Your Pixels (example: key=123)
  • action
    • Defines the conversion event type: init (Page view), lead, or purchase (example: a=init)
  • session_id
    • A hashed session ID. This enables us to distinguish multiple events by the same visitor. (example: uid=7375636365737340706f647369676874732e636f6d)Populate these values
  • type
    • Lead type
  • value
    • Lead category

 

3. [Optional] Construct your purchase pixel URL: 

https://img.byspotify.com?key={pixel_id}&a={action}&uid={session_id}&alias={alias}
Check out a completed purchase example here: https://img.byspotify.com?key=123&a=purchase&uid=7375636365737340706f647369676874732e636f6d&alias=abc&value=100&currency=USD&order_id=12345

Populate these values: 
  • pixel_id
    • (Same as above) Copy the numeric value found on Manage > Your Pixels (example: key=123)
  • action
    • Defines the conversion event type for purchase (example: a=purchase)

  • session_id
    • (Same as above) A hashed session ID. This enables us to distinguish multiple events by the same visitor. (example: uid=7375636365737340706f647369676874732e636f6d)
  • value
    • numerical purchase value
  • currency
    • string
  • order_id
    • string

Step 2

Pass through these headers:

  • X-Forwarded-For (Required)
  • UserAgent (Required)
  • Referer (Optional - to report on landing page URL)

Step 3

From the Spotify Ad Analytics dashboard, go to Manage > Your Pixels > click onto your alpha-numeric Pixel ID. 

Use the graph to confirm that the raw event daily sum matches expected volume. 

When you hover on the graph, these events will be labeled as Img Init, Img Lead, or Img Purchase to distinguish from JavaScript pixel traffic.