โ๏ธEmbed SDK
Introduction
Its goal is to allow you to interact deeper between your application and Toucan embeds. Youโll be able to give a truly seamless user experience and have full control over what is displayed in your embeds.
You can find the embed SDK script in "Admin Area > Embed Manager > Embed Settings".
All you need to do is copy/paste that script into your application and youโre good to start playing with it.
SDK Key
Create a dedicated token following our documentation Embed SDK Authentication.
Glossary
Ids
embedId
: It is the unique id used in the embed script.DOMId
: It is the combination betweenembedId
+ a random hash. It allows you to integrate the same embed on the same page several times.
Example:
Filters
We will also talk about Filters.
TcTcEmbed
The script will attach to window
our TcTcEmbed
object, ready to be created.
getAll()
Returns an array of HTMLElement
for each embed on the page.
Parameters
N/A
Returns
HTMLElement
Example
embedDOMIds()
Returns an array of DOMIds
.
Hint
embedId
!== DOMId to
avoid issues when integrating multiples times the same embed on the same page
Parameters
N/A
Returns
string[]
Example
Example
setExtraVariablesForAllEmbeds()
Set variables from external context for all embeds
Parameters
Returns
void
Example
setFilterValueForAllEmbeds()
Set the value of one requester for all embeds.
Parameters
Returns
void
Example
insertEmbedById()
Insert an Embed programmatically in the DOM.
Important
This method needs an authentication token (cf. Embed SDK Authentication)
Parameters
Returns
Success:
Promise<Embed>
Error
when
targetEl
isn't anHTMLElement
Example
get()
Get the instance of an Embed
Using DOMId rather than EmbedId can be useful if youโre using multiple times the same embed on a single page.
Parameters
Returns
Promise<Embed>
Example
sendPDFReport()
If you donโt know what is it, click here for more information.
Allows to send synchronously the PDF report of a targeted small application for a list of recipients. Each listโs item is an object of token
and variables
. Weโre using the tokens to get directly all the user context and permissions, such as her email (in the field username
) and her groups, and/or attributes
that will be important to send the right PDF report.
Important
This method needs an authentication token (cf. Embed SDK Authentication)
Parameters
Returns
Success:
Promise
.Error:
if at least one email didnโt reach its user.
Everyone will receive a PDF report for shop A
, except the 3rd user on which we precise to use shop B
value.
Embed
refreshDataQueries()
Rerun queries for a given Embed
.
Parameters
N/A
Returns
void
Example
filterIds()
Returns all the requester ids for a given Embed
Parameters
N/A
Returns
string[]
Example
getFilter()
Return a Filter
for a given Embed
Parameters
Returns
Filter
Example
setExtraVariables()
Set variables from external context for a given Embed
Parameters
Returns
void
Example
Event Emitter System
Whatโs for?
This module allows you to listen to Toucan Events to interact deeply with your embedded stories!
Important
The following Charts are supported:
Circularchart
Leaderboard
Linechart
Barchart
Barlinechart
Heatmap
Mapchart
Bulletchart
Stackedbarchart
subscribe
Allow to listen to Toucan Events. The following events are available:
chart:selection
: whenever the user selects an element in a visualization (bar, bubble, zone, etc.)chart:drill
: whenever the user interacts with a drillable element in a visualization (bar, bubble, zone, etc.)
Parameters
Callback function returns
EventData
Context
chart:selection
chart:drill
unsubscribe
Destroy listeners to Toucan events.
Returns
void
Example
Filter
A Filter
is an interface element to change the data in our visualization. Its values are based on a column present in the used dataset.
values()
Return all data row values for a given Filter
Parameters
N/A
Returns
Record<string, any>[]
Example
currentValue()
Return the current value for a given Filter
Parameters
N/A
Returns
Record<string, any>
setValue()
Set the current value for a given Filter
Parameters
Returns
void
Example
Last updated