Skip to main content
VitePress
current

Search documentation

Type to search this documentation.

Carbon Ads

Integrate Carbon Ads into your VitePress site using the default theme's built-in support.

VitePress has built in native support for Carbon Ads. By defining the Carbon Ads credentials in config, VitePress will display ads on the page.

JavaScript
export default {
  themeConfig: {
    carbonAds: {
      code: 'your-carbon-code',
      placement: 'your-carbon-placement',
      format: 'classic'
    }
  }
}

These values are used to call carbon CDN script as shown below.

The format option supports classic, responsive, and cover.

JavaScript
`//cdn.carbonads.com/carbon.js?serve=${code}&placement=${placement}&format=${format}`

To learn more about Carbon Ads configuration, please visit Carbon Ads website.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu