Video Factory

Video factory provides builder methods to help you create/update Firework video objects.

Video builder actions

Name
Description
Required

actionType

Click-To-Action type or label

No

actionUrl

Click-To-Action url

No

caption

Video title

No

clearProducts

Clear previous product cards

No

product

Adds product card to the video

No

Sample Code bellow uses fw:video:impression event to update current video with new video object created using videoFactory

document.addEventListener('fw:video:impression', function (event) {
  event.detail.actions.video.update(({ videoFactory }) =>
    videoFactory((videoBuilder) =>
      videoBuilder.clearProducts().product((productBuilder) =>
        productBuilder
          .extId('123')
          .name('The Spider: The Disgusting Critters Series')
          .description(
            "Part of a series of hilarious nonfiction about disgusting creatures, this book looks at the spider. It covers such topics as the spider's habitats (pretty much everywhere but outer space), the silk it spins (it can trap prey and makes a nifty bowtie), and its parenting practice (female spiders carry around their eggs in a silk purse). Although silly and off-the-wall, The Spider contains factual information that will both amuse and teach at the same time.",
          )
          .currency('USD')
          .variant((variantBuilder) =>
            variantBuilder
              .extId('123paperback')
              .name('Paperback')
              .price(6.99)
              .url(
                'https://www.amazon.com/Spider-Disgusting-Critters-Elise-Gravel/dp/1101918543/ref=sr_1_7?keywords=spiderman&qid=1697209079&s=books&sr=1-7',
              )
              .isAvailable(true)
              .image((imageBuilder) =>
                imageBuilder
                  .extId('123paperback')
                  .title('Paperback')
                  .url(
                    'https://m.media-amazon.com/images/I/81pMrLrnmGL._SL1500_.jpg',
                  ),
              ),
          )
          .variant((variantBuilder) =>
            variantBuilder
              .extId('123hardcover')
              .name('Hardcover')
              .price(10.99)
              .url(
                'https://www.amazon.com/Flora-Ulysses-Illuminated-Elise-Gravel/dp/1770496645/ref=tmm_hrd_swatch_0?_encoding=UTF8&qid=1697209079&sr=1-7',
              )
              .isAvailable(true)
              .image((imageBuilder) =>
                imageBuilder
                  .extId('123hardcover')
                  .title('Hardcover')
                  .url(
                    'https://m.media-amazon.com/images/I/81pMrLrnmGL._SL1500_.jpg',
                  ),
              ),
          ),
      ),
    ),
  )
})

Last updated