# Carousel / Grid

Embed feed - Carousel or Grid allows the content to be displayed as a row or grid of thumbnails. Embed feeds are usually used for content discovery where the user can see multiple content and increases the chance to initiate the content engagement.

<div align="left"><img src="https://business.firework.com/carousel.gif" alt="Carousel"> <img src="https://business.firework.com/grid.gif" alt="Grid"></div>

## Integration

{% tabs %}
{% tab title="HTML" %}
Place the javascript part either on the `<head>` or `<body>` or right above the Firework component you are adding.

```markup
<script async src="//asset.fwcdn3.com/js/embed-feed.js" type="text/javascript" ></script>
```

Place the web component where the feed should be displayed.

```markup
<fw-embed-feed
  channel="your-channel"
  mode="row"
></fw-embed-feed>
```

{% endtab %}

{% tab title="Wordpress Plugin" %}

1. Visit [**https://wordpress.org/plugins/firework-videos/#installation**](https://wordpress.org/plugins/firework-videos/#installation) or search for `Firework Videos` in your WordPress Admin plugins area.
2. Follow the instructions to install, activate and place the plugin's widget.
3. Connect your feed using provided **app\_id**

{% hint style="info" %}
Direct **Javascript** integration works for Wordpress as well.\
Use <https://wordpress.org/plugins/ad-inserter/> to simplify copy\&paste.
{% endhint %}
{% endtab %}

{% tab title="AMP" %}
AMP HTML header part (avoid duplication with previously declared scripts)

```markup
 <script async custom-element="amp-access" src="https://cdn.ampproject.org/v0/amp-access-0.1.js"></script>
 <script async custom-element="amp-iframe" src="https://cdn.ampproject.org/v0/amp-iframe-latest.js"></script>
 <script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js"></script>
```

AMP HTML header part

```markup
    <script id="amp-access" type="application/json">
    [{
        "noPingback": true,
        "authorization": "https://fireworktv.com/embed/amp-access?&source_url=SOURCE_URL&ampdoc_url=AMPDOC_URL&canonical_url=CANONICAL_URL&document_referrer=DOCUMENT_REFERRER&reader_id=READER_ID&_=RANDOM",
        "authorizationFallbackResponse": {
            "access": false,
            "error": true
        },
        "namespace": "fwn"
    }]
    </script>
```

AMP HTML body part. Search for `{CHANNEL}` and replace with your **channel name**. Other params can be serialized as iframe src querystring.

```markup
<!-- This part goes to body -->
<section amp-access="fwn.access">
    <template amp-access-template type="amp-mustache">
        <amp-iframe height="300" layout="fixed-height" resizable width="auto" sandbox="allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-top-navigation allow-top-navigation-by-user-activation"
            src="https://fw.tv/iframe/embed-feed?&channel={CHANNEL}&open_in=_blank&page_url={{fwn.source_url}}"
        >
            <div overflow>Loading videos...</div>
            <div placeholder style="text-align:center;margin:50px 0;">
                <amp-img layout="fixed" width="300" height="118" src="https://asset.fireworktv.com/images/amp/firework.png"></amp-img>
            </div>
        </amp-iframe>
    </template>
</section>
```

{% endtab %}

{% tab title="iframe" %}
Firework provides iframe integration with some limitations, like opening a video in new tab only. Any attributes needs to be provided as a querystring to the iframe src attribute. Read more about [iframe limitations here](https://docs.firework.tv/web/troubleshooting#iframe_limitations).

```markup
<iframe
  frameborder="0"
  height="400"
  width="100%"
  sandbox="allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-top-navigation allow-top-navigation-by-user-activation"
  src="https://fw.tv/iframe/embed-feed?&channel={CHANNEL}&open_in=_blank&page_url={CURRENT_PAGE}"
></iframe>
```

{% hint style="info" %}
Firework's iframe solution should be suitable for Facebook Instant Articles without any issues. Please follow the FB guidelines on how to include embeds. <https://developers.facebook.com/docs/instant-articles/reference/embeds>
{% endhint %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
In case your page uses multiple widget components, insert `<script>` tag with combined `fwn.js` file instead of requesting each js file individually. This would improve your performance.

*Example:*

`<script`\
`async`\
`src="//asset.fwcdn3.com/js/fwn.js"`\
`type="text/javascript"`\
`></script>`
{% endhint %}

## Attributes

In addition to the attributes described below, there are Player Attributes (which affects the way player behaves) and Feed Attributes (which decides the content being displayed) . You can find the list of attributes specific to Embed Feed in the section below

{% content-ref url="../player/player-attributes" %}
[player-attributes](https://docs.firework.com/firework-for-developers/web/integration-guide/player/player-attributes)
{% endcontent-ref %}

{% content-ref url="../feed-attributes" %}
[feed-attributes](https://docs.firework.com/firework-for-developers/web/integration-guide/feed-attributes)
{% endcontent-ref %}

<table><thead><tr><th width="205">Name</th><th width="418.76234003656305">Description</th><th>Default Value</th></tr></thead><tbody><tr><td><code>mode</code></td><td><p><code>row | grid | pinned</code></p><p>One of three available display modes.</p></td><td><code>row</code></td></tr><tr><td><code>size</code></td><td><p><code>medium | large</code></p><p>Thumbnail size. Does not apply to <code>grid</code> mode</p></td><td><code>large</code></td></tr><tr><td><code>placement</code></td><td><code>top | middle | bottom</code> Informal value about placement position.</td><td></td></tr><tr><td><code>open_in</code></td><td><p>Where to open video player on thumbnail click.</p><ul><li><code>default</code> - this option will allow us to pick most suitable way how to open player on page based on browser, device and others</li><li><code>_modal</code> - popup-like modal (does not leave publisher site)</li><li><code>_self</code> - current tab</li><li><code>_blank</code> - new tab</li></ul></td><td><code>default</code></td></tr><tr><td><code>max_videos</code></td><td>Max. number of videos loaded for <code>grid</code> mode. Zero <code>0</code> creates grid with infinite scroll.</td><td></td></tr><tr><td><code>paginate_by</code></td><td>Page size for manual pagination in <code>grid</code> mode. Reveals "Load More" button to load next page. Please note<code>paginate_by</code> ** and ** <code>max_videos</code> are fuzzy numbers which do not allow any orphaned thumbnails to fall on next grid row.</td><td></td></tr><tr><td><code>autoplay</code></td><td><p><code>true | false</code></p><p>Autoplays first thumbnail.</p></td><td><code>true</code></td></tr><tr><td><code>captions</code></td><td><p><code>true | false</code></p><p>Show captions for autoplayed thumbnails</p></td><td><code>true</code></td></tr><tr><td><code>title</code></td><td>Specify title for <code>grid</code> mode. Defaults to localized "Stories and Short Videos"</td><td></td></tr><tr><td><code>product_tag_placement</code></td><td><code>top | bottom | false</code><br>Product tag indicating video contains a product card can be positioned on top, bottom or disabled.</td><td><code>top</code></td></tr><tr><td><code>thumbnail_cta</code></td><td>Ability to render CTA's in embed feed carousel thumbnails</td><td><code>false</code></td></tr><tr><td><code>thumbnail_product_card</code></td><td>Ability to display product cards in embed feed carousel thumbnails</td><td><code>false</code></td></tr></tbody></table>
