- Rock Content Knowledge Base
- Live
- Settings
API Visitor Tracking Script
Live users who pull stream content into a website using the API can use the tracking script below to gather analytics on visitor behavior.
This script should be placed on the page where your stream is displayed as close to the closing </body> tag as possible.
When placing this script on your site, the {streamID} value will need to be replaced with the actual numeric stream ID for your Live stream. You will find this at the end of the URL in your address bar when editing your stream within your Live console.
<script>
(function(t, elID, streamId) {
if (document.getElementById(elID)) return;
t = document.createElement(t);
t.id = elID;
t.type = 'text/javascript';
t.async = true;
t.src = 'https://cdn.scribblelive.com/modules/lib/addons.js?id='+streamId;
document.body.appendChild(t);
})('script', 'SLCountAddonScript', {stream-id});
</script>
When successfully loading the the tracking code, you should see one call to https://cdn.scribblelive.com/modules/lib/addons.js?id={stream-id} and then additional requests to http://counter.scribblelive.com/?page=2321949 once every 60 seconds.
NOTE: If you do attempt to load the tracking script multiple times on your page, it will only fully execute the first time.