[Solved] Campaigns/Referrers are shown as "Direct Entry"

We are testing Piwik in a productive environment for two weeks now. Piwik is unmodified and up-to-date. However about 30% - 50% of clicks from our paid campaigns (all with links ending in pk_campaign=Paid-SomeCampaignName) are shown as “Direct Entry”.
We cross checked our ngnix access logs and there we can clearly see that all these clicks do access the pages with the ?pk_campaign=Paid-SomeCampaignName parameter and that they also often do submit an referrer.
We also compared the ngnix log entries of accesses which show up with the correct campaign/referrer in Piwik with those that have the wrong “Direct Entry” tag in Piwik and there is a difference between both.
This is the case for all our campaigns (so Google AdWords, Bing and a bunch of other networks) and it’s always about 30% - 50%. However we were not able to reproduce it - so if we manually open a link with ?pk_campaign=Test-SomeCampaignName it always shows up. So maybe it has something to do with the referrer?

Any clues what’s going on here? We also would be very happy about tips how to troubleshoot/debug/trace this further.

Thanks in advance.

// Edit: Nevermind, what we see is triggered by a conditional redirect of ours which takes place in - who would have guessed - 30% - 50% and which prevents piwik.php from getting called on the initial access. And it was a JS redirect (Oo) so we did not see it on first glance in the nginx logs; however on second…

So, how did you solved it? Did you change anything on your virtual host? or in piwik?

As the redirect made some sense and it wasn’t worth it to invest much time in refactoring it to “cleaner” method, we simply extended it by checking for query parameters (also via JavaScript) and adding any of them in case they exist to the redirect URL as well. This way on the second full page load where piwik also got called correctly all parameters were still present for piwik.

Thanks a lot for your help.