Skip to content

Commit

Permalink
TMONE-894 - add trackers
Browse files Browse the repository at this point in the history
  • Loading branch information
dimanovoseltsev committed Feb 6, 2025
1 parent 3296f3e commit e403f27
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ $trackingInfo->setUserAgent ('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/53
$trackingInfo->setUserIPAddress ('10.0.2.2');
$trackingInfo->setUserLanguage ('en-US,en;q=0.8,uk;q=0.6,ru;q=0.4');
$trackingInfo->setUserLocalTime ('Tue May 27 2014 10:31:05 GMT+0300 (EEST)');
$trackingInfo->setTrackers (array(
"ga" => "GA1.1.1479631296.1738839056"
));

$order->setTrackingInfo ($trackingInfo);

Expand Down
26 changes: 23 additions & 3 deletions src/API2Client/Entities/Order/TrackingInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ class TrackingInfo
*/
protected $tSource;

/** @var array */
private $trackers;

/**
* @param string $affiliateName
*/
Expand Down Expand Up @@ -354,21 +357,37 @@ public function getWebdesignTime ()
}

/**
* @param \API2Client\Entities\Order\TrackingTSource $tSource
* @param TrackingTSource $tSource
*/
public function setTSource (TrackingTSource $tSource)
{
$this->tSource = $tSource;
}

/**
* @return \API2Client\Entities\Order\TrackingTSource
* @return TrackingTSource
*/
public function getTSource ()
{
return $this->tSource ? $this->tSource : new TrackingTSource ();
}

/**
* @param array $trackers
*/
public function setTrackers (array $trackers)
{
$this->trackers = $trackers;
}

/**
* @return array
*/
public function getTrackers ()
{
return (array)$this->trackers;
}

/**
* @return array
*/
Expand All @@ -392,6 +411,7 @@ public function toArray ()
'utmCampaign' => $this->getUtmCampaign (),
'webdesign' => $this->getWebdesign (),
'webdesignTime' => $this->getWebdesignTime (),
'trackers' => $this->getTrackers (),
);
}
}
}

0 comments on commit e403f27

Please sign in to comment.