Embed pinboard or visualization
Learn how to embed a visualization or Pinboard in your own Web page.
This page explains, through an example, how to embed either a ThoughtSpot visualization (table or chart) or a ThoughtSpot Pinboard from ThoughtSpot in your own static Web page, portal, or application.
You can get the link for an entire Pinboard, or single visualization
This procedure assumes the Pinboard with the visualization you want to embed already exists.
Log in to ThoughtSpot from a browser.
Navigate to a visualization on the Pinboard tab.
Open a Pinboard.
Copy the URL:
- Pinboard embedding
Click the More menu at the level of the Pinboard, , and select [-] Copy embed link. The format for the link is:
- Vizualization embedding
click the More menu on the visual you plan to embed, , and select [-] Copy embed link. The format for the link is:
You must edit the page in your application or web page where you want to embed a ThoughtSpot pinboard or visualization. For this example, you can get a copy of the test.html file.
Download the file and unzip it.
Create an empty directory called
test.htmlfile to the
apidirectory co-located with the
test.htmlfile in your favorite editor.
Scroll down to the
Variablessection (about line 37).
Here are the fields in the
test.htmlfile you must edit.
var protocol = "THOUGHTSPOT_PROTOCOL"; var hostPort = "HOST_PORT"; var pinboardId = "PINBOARD_ID"; var vizualizationId = "VIZUALIZATON_ID";
Edit each variable in the section and replace it with the IDs you copied from the pinboard.
For example, your URL may look similar to the following:
This is a link copied from an individual visualization, the result in the file is:
var protocol = "http"; var hostPort = "172.18.202.35:8088"; var pinboardId = "061457a2-27bc-43a9-9754-0cd873691bf0"; var vizualizationId = "9985fccf-b28d-4262-b54b-29619a38348e";
The protocol (
https) of your client and your ThoughtSpot instance must match. You can use this identifier in the next part.
Save your changes and close the
You must work with ThoughtSpot support to enable CORS between your client application domain and the ThoughtSpot domain.
If you don’t do this, you will receive an error message when
test.html attempts to load the embedded objects.
The test infrastructure uses Python’s
simplehttpserver, which runs by default as
ThoughtSpot support must have this information.
You can also copy the
test directory to an existing web server.
If you do this, you must DNS for the server when you contact Support.
You are almost ready to view your embedded pinboard and visualization.
The fastest way to run a webserver and test the code is using Python’s
If you have Python on your system you already have the
Log in to ThoughtSpot.
In production, you would have added authentication code to your client. You haven’t done that with this system. So, before you test, you must login to the ThoughtSpot. Successfully logging in causes the system to create a session and an authentication key. Your browser has this information and so when you load the
test.htmlpage in another tab, you won’t need to authenticate again.
Change to your
python -m SimpleHTTPServer 8000
Open your browser’s Developer tools.
Navigate to the test page in your browser.
See if your Pinboard or visualization appears in the browser window.
Check the browser console.
On success, the console reports a message similar to the following:
test.html:60 Initialization successful. test.html:113 http://172.18.202.35:8088/#/embed/viz/061457a2-27bc-43a9-9754-0cd873691bf0 test.html:129 http://172.18.202.35:8088/#/embed/viz/061457a2-27bc-43a9-9754-0cd873691bf0/9985fccf-b28d-4262-b54b-29619a38348e
If your embeds don’t load, open the developer tools on your browser, and look for errors in the page loading, usually on the Console tab.
You may see an error similar to the following:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
This occurs when the cross-domain (CORS) setting is incorrect on your ThoughtSpot cluster. Contact ThoughtSpot Support for more help.