Example #1
0
 /**
  * Keep a record of a untracked CTA and queue it for replacement
  *
  * @param CTA $cta
  */
 public function addUntrackedCTA(CTA $cta)
 {
     $this->untrackedCTAs[] = $cta;
     if ($cta->getShortenedExpandedUrl()) {
         $trackingUrl = $cta->getOriginalUrl();
         $shortenedUrl = $cta->getShortenedExpandedUrl();
     } elseif ($cta->getShortenedUniqueExpandedUrl()) {
         $trackingUrl = $cta->getUniqueExpandedUrl();
         $shortenedUrl = $cta->getShortenedUniqueExpandedUrl();
     } else {
         $trackingUrl = $cta->getOriginalUrl();
         $shortenedUrl = $cta->getOriginalUrl();
     }
     $this->queueForReplacement($cta->getOriginalUrl(), $cta->getExpandedUrl(), $trackingUrl, $shortenedUrl);
 }
Example #2
0
 /**
  * @param $url
  * @param Operation $operation
  * @param Location|null $location
  * @return CTA
  */
 protected function createCTA($url, Operation $operation, Location $location = null)
 {
     $cta = new CTA();
     $cta->setOperation($operation);
     $cta->setOriginalUrl($url);
     $cta->setExpandedUrl($this->expandUrl($url));
     if ($location) {
         $cta->setLocation($location);
         $cta->setTrackingId($this->generateTrackingId());
         $cta->setTrackingUrl($this->generateTrackingUrl($cta->getExpandedUrl(), $cta->getTrackingId()));
         $cta->setShortenedTrackingUrl($this->getShortenedUrl($cta->getTrackingUrl()));
     }
     return $cta;
 }