Dynamic Ads for Automotive - Events

Dynamic Ads for Vehicles uses 4 events. Every event has a set of parameters.

EventWhen to Fire

Search

When the user searches for vehicles

ViewContent

When the user views a vehicle detail page

AddToWishlist

When the user saves, favorites or stars a vehicle

Lead

On the landing page, after the user completes registration and submits a lead form

Set Up Facebook Pixel

The Facebook Pixel is a small piece of JavaScript code in your website that tracks the visitors' behavior and actions in the website. When a visitor interacts with the website, pixel events are fired in response to someone's actions. A pixel event is a lightweight HTTPS request sent from the visitor's browser to Facebook's servers together with some extra information about that event, such as the page URL that someone views, product id or price of the product. To enable this tracking, you need to modify your web site and insert JavaScript code in certain pages.

Correctly setting up the pixel code is important for Dynamic Ads because our machine learning algorithm relies on the visitor-product interaction data in the web site collected from the pixel code. Without these data, Dynamic Ads can't make good recommendations to potential customers with a high probability to convert.

Pixel Specifications

Field NameTypeRequiredExample

event_name

String

Yes

ViewContent, Lead, Search, AddToWishlist

content_type

String

Yes

vehicle

content_ids

array of strings

Yes

['123', 456]

postal_code

String

No

94025

make

String

No

Acura

model

String

No

MDX

year

int

No

2015

vin

String

No

KL9CD9S99EC111111

condition_of_vehicle

enum

No

new

exterior_color

String

No

black

transmission

enum

No

automatic

body_style

enum

No

sedan

fuel_type

enum

No

diesel

drivetrain

enum

No

AWD

price

float

No

2000

price_range

[float (min), float (max)]

No

Price range of the vehicle, such as [10000.99, 20000.99]

currency

String

No

Currency for the price. Specified using ISO 4217 currency format, such as USD.

Make sure the pixel base code is already loaded when you fire an event. If you use a tag manager, make sure you include the tag that contains the pixel code on every page. The tag should appear before the tag that contains the pixel event code. Use the Facebook Pixel Helper to validate your pixel implementation.

ViewContent Pixel Event

    <script>
    !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
    n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
    n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
    t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
    document,'script','https://connect.facebook.net/en_US/fbevents.js');
    fbq('init', '<FB_PIXEL_ID>'); // pixel id
    fbq('track', "PageView");
    fbq('track', 'ViewContent', {
      content_type: 'vehicle', // REQUIRED: DO NOT change this, must be set to 'vehicle'
      content_ids: ['123'], // REQUIRED: array of vehicle IDs
      postal_code: '94025', // optional
      make: 'Lexus', // optional
      model: 'ES', // optional
      year: '2017', // optional
      vin: 'xxxxxxxxxxxx', // optional
      condition_of_vehicle: 'used', // optional
      exterior_color: 'black', // optional
      transmission: 'automatic', // optional
      body_style: 'sedan', // optional
      fuel_type: 'gasoline', // optional
      drivetrain: 'awd', // optional
      price: 1234.99, // up to 2 decimals optional
      currency: 'USD', // required if price and preferred_price_range is used 
      preferred_price_range: '[10000,20000]' //up to two decimals, min,max
});
</script>

If you're already using Dynamic Product Ads (DPA), send an additional event for Dynamic Ads for Automotive (DAA):

    <script>
    !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
    n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
    n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
    t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
    document,'script','https://connect.facebook.net/en_US/fbevents.js');
    fbq('init', '<FB_PIXEL_ID>'); // pixel id
    fbq('track', "PageView");
    // if using DPA
    fbq('track', 'ViewContent', {
      content_type: 'product',
      content_ids: ['1234'], 
    }); 

    fbq('track', 'ViewContent', {
      content_type: 'vehicle', // REQUIRED: DO NOT change this, must be set to 'vehicle'
      content_ids: ['123'], // REQUIRED: array of vehicle IDs
      postal_code: '94025', // optional
      make: 'Lexus', // optional
      model: 'ES', // optional
      year: '2017', // optional
      vin: 'xxxxxxxxxxxx', // optional
      condition_of_vehicle: 'used', // optional
      exterior_color: 'black', // optional
      transmission: 'automatic', // optional
      body_style: 'sedan', // optional
      fuel_type: 'gasoline', // optional
      drivetrain: 'awd', // optional
      price: 1234.99, // up to 2 decimals optional
      currency: 'USD', // required if price and preferred_price_range is used 
      preferred_price_range: '[10000,20000]' //up to two decimals, min,max
});
</script>