Zencastr Tracking Pixel Installation

In this document, we will review how to track conversions for podcast campaigns from Zencastr.

Zencastr works off of a Pageview event and Conversion event system. Very similar to how Google Analytics tracks events. Both the Pageview event and Conversion event are handled by including the Zencastr WebPixel library on your site.

To install Zencastr's WebPixel library, copy the code snippet provided on your dashboard to your client-side source code. By placing this code snippet on the page, we will automatically track the pageview event.

Follow these steps to find your code snippet:

  1. Log-in into your account here
  2. Go to the user menu (at top-right corner) and click on “Settings”
  3. On the left menu, click on “Tracking”
  4. Click “Copy Script”
0:00
/0:05

Content Security Policy

If your website has Content Security Policy enabled, you will need to include these two lines:

script-src 'unsafe-inline' https://media.zencastr.com;

connect-src https://t.zen.ai;

Example

zpix('event', 'event-name', { ...eventPayloadData });

Conversion Event

If you are not using Zencastr's attribution apps, you will need to track conversions manually using Zencastr's WebPixel library. This event should only be triggered when the agreed upon conversion happens within your app (for example, a sale or signup). Below is an example of how you can use the Zencastr WebPixel library to track these conversion events.

Zencastr WebPixel library is exposed as a global zpix variable in the Window context. To trigger an event, call the zpix function with the following parameters:

Field name

Type

Required?

Description

method

string

yes

Should be the literal string ‘event’

eventName

string

yes

Check the available options below

eventPayloadData

object

yes

The event payload, check the details for each event below

Event ‘purchaseConversion’

Triggered when a user completes a purchase.

Field name

Type

Required?

Description

purchasePrice

number

yes

The price as a double with 2 precision

currency

string

yes

The currency (only ‘USD’ is supported)

discountCode

string

yes

The discount/promotion/coupon code used in the purchase

order

string

yes

Some string that identify the order (like the order id)

customerId

string

yes

Some string that identifies the user (like the user id or email)

newCustomer

boolean

yes

Should be true if the user is a new customer

items

array

no

The list of items included in the purchase

items[*].price

number

yes

The product price as a double with 2 precision

items[*].quantity

string

yes

The quantity of this item

items[*].productId

string

yes

Some ID that identifies the product

items[*].productName

string

yes

The product name

items[*].productType

string

yes

The product type


Example

zpix('event', 'purchaseConversion', {


  // REQUIRED


  purchasePrice: 49.0,

  currency: 'USD', // only support usd initially

  discountCode: 'PODCAST_CODE',

  order: '12322323232',

  customerId: '987654321',

  newCustomer: true, // is this a new purchase or a purchase from a returning customer?


  // OPTIONAL


  items: [

    {

      price: 49.0,

      quantity: 1,

      productId: 'price_1LZPouEp649wfj6RfhXWnOEv’,

      productName: 'Zencastr Growth subscription (monthly)',

      productType: 'Subscription',

    }

  ],


});