Hello, it’s me again.
We now have a working solution. The drawback with that solution is, that the piwik source code has been changed. A colleague of mine made sure that the cookie domain set in the config.ini.php is also used for 3rd party cookies.
As my previous post suggested (which is not visible yet for me), the cookie domain is correctly put into the Response Headers ‘Set-Cookie’ of the JS tracker that requests the piwik server, but only for 1st party cookies. 3rd party cookies do not have the domain information set in the header.
The following changes to the piwik code now fixes that and allows to explicitly set the 3rd party cookie domain, at least from the config.ini.php which could look like that:
...
use_third_party_id_cookie = 1
cookie_name = _pk_uid
cookie_path = "/"
cookie_domain = ".mydomain.tld"
...
The following changes were made to the piwik source code that I got here. It’s version 1.12.
I mention that because I perceived that there seem to be different files in the GitHub repository and the version you can download from the link I just mentioned.
First of all we added the parameter ‘domain’ to the constructor of the cookie. It concerns the file
Cookie.php:
public function __construct($cookieName, $expire = null, $path = null, $domain = null, $keyStore = false)
{
$this->name = $cookieName;
$this->path = $path;
$this->domain = $domain; // NEW!
$this->expire = $expire;
...
Eventually we adapted the usages of that construction in two files: Visit.php and IgnoreCookie.php
Visit.php
protected function recognizeTheVisitor()
{
$this->visitorKnown = false;
$this->setCookie(new Piwik_Cookie(
$this->getCookieName(),
$this->getCookieExpire(),
$this->getCookiePath(),
$this->getCookieDomain())); // NEW!
$this->printCookie();
IgnoreCookie.php:
static public function getTrackingCookie()
{
$cookie_name = @Piwik_Config::getInstance()->Tracker['cookie_name'];
$cookie_path = @Piwik_Config::getInstance()->Tracker['cookie_path'];
$cookie_domain = @Piwik_Config::getInstance()->Tracker['cookie_domain']; // NEW!
return new Piwik_Cookie($cookie_name, null, $cookie_path, $cookie_domain); // CHANGED!
}
....
static public function getIgnoreCookie()
{
$cookie_name = @Piwik_Config::getInstance()->Tracker['ignore_visits_cookie_name'];
$cookie_path = @Piwik_Config::getInstance()->Tracker['cookie_path'];
$cookie_domain = @Piwik_Config::getInstance()->Tracker['cookie_domain']; // NEW!
return new Piwik_Cookie($cookie_name, null, $cookie_path, $cookie_domain); // CHANGED!
}
Now, we get our third party cookie correctly set to a wildcard domain 
My hope is that these changes fit into the (don’t know how to say) “piwik coding policy” and thus could be included into the official piwik sources. This way we got an improvement of piwik itself, as well as updating piwik won’t be painful for us 
Please tell me what I can do in order to introduce these changes or speed up that process and whether it is reasonable for you at all.
Regards,
Tom