Problems in goal tracking in Shopify thank you page and cloaked links

Hey,
I sell a few products on Shopify and want to track purchases as goal conversions with a value.
I have added piwik code in the thank you page and it’s not tracking the conversions.

I have also the same problem with some wordpress sites where i redirect urls and try to track conversion.
So guy clicks link http://website.com/go/link and then it’s redirected to an affiliate link.I have the piwik code on the middle page.

Anybody have similar issues? How to fix it? Thanks!

This is the code I use for shopify

var _paq = _paq || [];
_paq.push([‘trackGoal’, 4, {{ total_price | money_without_currency }}]);
_paq.push([‘trackPageView’]);
_paq.push([‘enableLinkTracking’]);
(function() {
var u="//xxxxxxxxxxxxxxxx.com/";
_paq.push([‘setTrackerUrl’, u+‘piwik.php’]);
_paq.push([‘setSiteId’, ‘2’]);
var d=document, g=d.createElement(‘script’), s=d.getElementsByTagName(‘script’)[0];
g.type=‘text/javascript’; g.async=true; g.defer=true; g.src=u+‘piwik.js’; s.parentNode.insertBefore(g,s);
})();