Using _paq.push like c dimensions with Matomo Tag Manager

What are the requirements to use _paq functions (like custom dimensions pushs) with the matomo tag manager? Does it always work when I only include Matomo tag manager on my site?
Or is it mandatory that I include the matomo tracking code snippet (as a tag at the end of the head)?

I implemented custom dimensions pushs as html-tags. Sometimes it works, sometimes it doesn’t. Is there a special sequence that I have to follow? I have the “feeling” that a _paq.push([‘trackPageView’]); should come after the dimension push. Can someone confirm this?