New Blog Template and WP-Piwik

When creating a new site based on a template the new site has the same piwik id as the base template site. I came across this post, but I am receiving an error when I implement the posted code.

Not sure if need to edit the code suggested, or if the posted code is now out-dated.