"Raw" Embedding refers to the original technique of using the "embed.js" file for embedding content using Pyramid. The file contains basic functions needed to embed content and it is used in conjunction with the REST APIs needed for authentication.
- To better understand how to use the raw embedding approach, see the example below.
- For more in depth examples of using the raw approach with the APIs, also see the dynamic embedding examples
Note: As of version 2020.10, the Embed APIs approach is recommended, since it provides a more object oriented approach to embedding with formal support for React, Angular and TypeScript - all operating via NPM.
Raw Embedding Example
Once you've saved your visual, the embed button will appear in the Discover or Present tab.
You can also access the embed button from the CMS. Find the visual in its folder location, right click, and under Actions Panel select Metadata.
The embed option will be displayed in the panel.
When you select the Embed option, an HTML code snippet will be generated in the dialog. Select Copy to copy the embed code to clipboard, and then add it to your HTML editor.
This snippet should be placed into the host HTML page. The snippet includes 2 directives:
- The DIV directive is a 'pre-cooked' embed tag for reading in the targeted item onto the host page. You can add multiple DIV tags per page for multiple visuals.
- The Embed tag provided here is simply a quick-start example. Developers can generate this tag and its relevant pointers programmatically if they choose to.
<div data-id="f7403052-d501-4a28-8deb-1ca3da1f8eab" data-type="discovery" class="pyramid-embed pyramid-auto" style="width:1000px;height:400px;" data-host="http://mysite"></div>
Once this is done, the embed authentication model needs to be resolved. Click here for more.