Here's the Universal Analytics tracking code for my Rails-based app. (It can be found in _analytics.html.erb, which is loaded as a partial in application.html.erb)
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-44709438-1', 'auto');
ga('set', '&uid', {{USER_ID}}); // Set the user ID using signed-in user_id.
ga('send', 'pageview');
</script>
Question: how do I set USER_ID using Ruby? Is the following right?
ga('set', '&uid', <% current_user.id %>); // Set the user ID using signed-in user_id.
If not, how can I do this?