Starting Taku manually

If you want to manually start the Taku widget, you can use a global Taku function. First, update your website html file to include the Taku script like this:

1
<html>
2
<body>
3
...
+
<script>
+
!function(t,e,a,n){function c(){if(!e.getElementById(a)){var t=e.getElementsByTagName(n)[0],c=e.createElement(n);c.type="text/javascript",c.async=!0,c.src="https://cdn.taku-app.com/js/latest.js",t.parentNode.insertBefore(c,t)}}if("function"!=typeof t.Taku){var s=function(){s.q.push(arguments)};s.q=[],t.Taku=s,"complete"===e.readyState?c():t.attachEvent?t.attachEvent("onload",c):t.addEventListener("load",c,!1)}}(window,document,"taku-js","script");
+
</script>
7
</body>
8
</html>

Next, you can activate the Taku widget when a user logs in or on a specific page with the following code:

1
window.Taku('news:boot', {
2
api_public_key: 'Your public API key. You will get it after sign up.',
3
user_id: "USER_ID", // Replace with the actual user ID
4
});

Just remember to replace "USER_ID" with the actual ID of your user.

When a user logs out, it's important to turn off the Taku widget to avoid confusing different user sessions. Add this code to the part of your program that handles user logouts:

1
window.Taku('news:shutdown');

Good job! You've added the Taku widget to your site. To customize it, tweak the options in the Taku('boot', takuSettings) command. See the Taku function API for details.

Next steps

For more information on what to do next, we recommend the following sections: