Embed a Block

Embed code used in sandbox must be changed for production. The environment and block ID will be different for sandbox and production environments.

The following steps describe a generic overview of embedding a block. Not all blocks produce the same embed code. To embed a web component, see Embed an OAuth Web Component.

Blocks are embedded on your site using iframes. Why iframes?Closed

Nitro blocks use iframes to embed an HTML document on a web page with a link to our content in the "src" attribute. This HTML document renders completely separate from the parent page, basically serving as a window to the iframe page.

Because Nitro iframes are fully encapsulated from the parent page, CSS rules and JavaScript logic of the parent page cannot alter the functionality of the Nitro embed and the Nitro embed cannot alter the CSS rules and JavaScript logic of the parent page.

Iframes provide greater security when embedding content as the iframe does not give read/write control of the entire page to Nitro.

Once a block is embedded on your site, any changes made to the block in the Block Builder will automatically update the embedded block. The block's ID creates the connection between Nitro Studio and the embed code and sends changes directly to the block without additional development.

  1. Use the Block Builder to create a block and get its embed code.
  2. Add the embed code on your page where you want the block to display.
    • Set the height and width of the iframe.
    • Set the block to use a 3-legged OAuth token.
    • Make sure the block type and ID match the name and ID of the block you created in Nitro Studio.

Example URL

Copy
src="https://blocks.bunchball.com/embeds/recognitions/2eeba795-7435-4f99-0000-4b8c3d6457a3?token=8e2b705164cc40000dd9bc736363ce12c5b"

URL Parameters

Parameter

Description

Value

environment

The environment where the block was created and is pulling data from.

  • Production - blocks.bunchball.com
  • Sandbox - blocks.sandbox.bunchball.com

embeds

The Nitro repository that stores the blocks.

embeds

type

The name of the block type.

Block types include: recognitions

block ID

An ID unique to the block.

The ID is generated by Nitro. Example: af513949-af37-427b-a596-caa49817E1e0

token

The access token received from a token request.

Set to populate the variable for the OAuth token. Replace the parameter with a variable containing the 3-legged OAuth token at runtime.

language

A language code if your program is localized.

Set to populate the variable with a language code representing the user's locale. Replace the parameter with the user's language code at runtime.

Example Embed Code

Copy
<div style="width: 485px; height: 650px">
  <iframe title="Recognitions"
    style="border: none; width: 100%; height: 100%"
    src="https://blocks.bunchball.com/embeds/recognitions/2eeba795-7435-4f99-0000-4b8c3b9e3?token=cdf0a422ABC123">
    </iframe>
</div>
        

See also

Blocks

Styling blocks

OAuth Client