Company Metrics Widget
The company metrics widget allows you to embed common dataset metrics into your website or application. In order to use this widget, please contact sales so that your account is activated for widgets.
Generating tokens
You website or app needs to generate a token on the backend to authenticate and display the widget. Tokens are good for 15 minutes only and require a widget-activated client_id and client_secret.
Tokens are generated via HTTP basic authentication to https://www.thinknum.com/authenticate
A example of how to authenticate:
curl -u CLIENT_ID:CLIENT_SECRET https://www.thinknum.com/authenticate
import urllib2
import base64
import json
request = urllib2.Request("https://www.thinknum.com/authenticate")
base64string = base64.b64encode(
"{client_id}:{client_secret}".format(
client_id="CLIENT_ID",
client_secret="CLIENT_SECRET"
)
)
request.add_header("Authorization", "Basic %s" % base64string)
response = json.load(urllib2.urlopen(request))
print response.get("token")
The authentication response will be a JSON string with the token under the "token" key.
{
"token": "TOKEN_HERE"
}
The widget code
Add an iframe widget to your website or app using one of the below examples, replacing "TOKEN" with the token you dynamically generated on the backend.
For TICKER based company profiles, use the "ticker" query parameter:
<script src="https://www.thinknum.com/embed/company/injector.js" type="text/javascript"></script>
<script type="text/javascript">
Thinknum.initialize({
token: "TOKEN",
ticker: "TICKER",
width: 400,
height: 300
});
</script>
For CUSIP based company profiles, use the "cusip" query parameter:
<script src="https://www.thinknum.com/embed/company/injector.js" type="text/javascript"></script>
<script type="text/javascript">
Thinknum.initialize({
token: "TOKEN",
cusip: "CUSIP",
width: 400,
height: 300
});
</script>
For ISIN based company profiles, use the "isin" query parameter:
<script src="https://www.thinknum.com/embed/company/injector.js" type="text/javascript"></script>
<script type="text/javascript">
Thinknum.initialize({
token: "TOKEN",
isin: "ISIN",
width: 400,
height: 300
});
</script>
You can also add a "compliance" parameter. It should contain URL-encoded text that will be displayed each time user tries to navigate from your website to Thinknum:
<script src="https://www.thinknum.com/embed/company/injector.js" type="text/javascript"></script>
<script type="text/javascript">
Thinknum.initialize({
token: "TOKEN",
ticker: "TICKER",
width: 400,
height: 300,
compliance: "Are you sure you want to navigate away?"
});
</script>
Once you've setup your backend to fetch a token, and dynamically added the proper iframe to your frontend, your users will be able to view Thinknum company metrics directly in your website or app.
Remember: never expose your client_id or client_secret from your website or app!
Updated almost 6 years ago