Getting Started
Embedding a Live Blog requires two steps: Including the script and calling the embedLiveblog API Method.
View the Preview
Check out our EmbedJS Preview: News Example
Including the script
The best way to include the script is to use the following snippet:
<script>
(function(e,t,n,r,i,s,o){e[i]=e[i]||function(){(e[i].q=e[i].q||[]).push(arguments)},
e[i].l=1*new Date;s=t.createElement(n),o=t.getElementsByTagName(n)[0];s.async=1;
s.src=r;o.parentNode.insertBefore(s,o)})(window,document,"script",
'//cdn.tickaroo.com/embedjs/tik3.js',"_tik");
</script>
The snippet has been optimized to provide the best possible speed and stability for your site rendering. It is non-blocking during DOM rendering and provides an asynchronous API which allows to make calls even before the script has been loaded.
This has to be done only once on the page, no matter how many widgets or embeds you are including on the page.
Calling an API Method
The API provides a wrapper to ensure the library is completely loaded before it makes a call. Every call should go through the wrapper. You can either make an indirect call if you don’t care about return values of the call or you can provide a function which is executed in the context of the API. Although it is possible to make directly call the Tickaroo object, it is discouraged to do so.
Example:
// 1: Make an indirect call.
// The method will be called as soon as the library is fully loaded.
// There is no return value.
_tik("embedLiveblog", {
container: "#tickaroo-liveblog",
clientId: "YOURCLIENTID",
id: "YOURLIVEBLOGID"
});
or
// 2: Provide a function to call as soon as the library is fully loaded.
_tik(function() {
var liveblog = Tickaroo.embedLiveblog({
container: "#tickaroo-liveblog",
clientId: "YOURCLIENTID",
id: "YOURLIVEBLOGID"
});
});
Embedding a Live Blog
To embed a ticker, you need to call the embedLiveblog method. At a minimum you need to provide the ID of the ticker and a container DOM Node in which the ticker should be embedded.
Example:
<div id="tickaroo-liveblog"></div>
<script>
_tik(function() {
window.liveblog = Tickaroo.embedLiveblog({
container: "#tickaroo-liveblog",
clientId: "YOURCLIENTID",
id: "YOURLIVEBLOGID"
});
})
</script>
YOU NEED TO REPLACE “YOURCLIENTID” WITH YOUR ACTUAL CLIENT ID PROVIDED BY TICKAROO AND “YOURLIVEBLOGID” WITH THE ID OF ONE OF YOUR LIVEBLOGS!
Note:
- It is not necessary to store the return value of embedLiveblog if you don’t intend to use it. Using the window object is also not necessary.
- There are a lot of options for embedLiveblog. By default, the script handles everything from auto-reload to timestamps. This behavior can be changed. See below for details.
- The content of the container will be replaced with the ticker once it has been loaded. If you like, you can provide some kind of loading spinner or other content in the container tag.
Using an iFrame
Example:
<div id="iframe"></div>
<script>
_tik(function() {
window.liveblog = Tickaroo.embedIframeUrl({
container: "#iframe",
url: "//webwidget.tickaroo.com"
});
})
</script>