Add new domain to account
@param string $apikey ApiKey that gives you access to our SMTP and HTTP API's.
@param string $domain Name of selected domain.
@param \ElasticEmailEnums\TrackingType $trackingType
349025
public function Add($domain, $trackingType = \ElasticEmailEnums\TrackingType::Http) {
        return $this->sendRequest('domain/add', array(
                    'domain' => $domain,
                    'trackingType' => $trackingType
        ));
    }
1267240
protected function generateTrackingUrl($url, $trackingId)
    {
        $trackingUrl = ParserUtil::addUrlParam($url, $this->trackingIdName, $trackingId);
        
        // Pass the base URL if tracking script runs in dev or dev-stay mode.
        if($this->trackingJsMode == 'dev' || $this->trackingJsMode == 'dev-stay'){
            $trackingUrl = ParserUtil::addUrlParam($trackingUrl, 'cctapi', urlencode($this->baseUrl));
        }

        return $trackingUrl;
    }
434711
private static String trackingNumberURL(String carrier, String trackingNumber)
			throws AuthenticationException, InvalidRequestException, APIConnectionException, APIException {
		try {
			return String.format("%s/%s/%s", classURL(Track.class), urlEncode(carrier), urlEncode(trackingNumber));
		} catch (UnsupportedEncodingException e) {
			throw new InvalidRequestException("Unable to encode parameters to " + CHARSET
					+ ". Please contact support@goshippo.com for assistance.", null, e);
		}
	}
1013354
def register_domain(self, domain=0, tokenizer=None, trie=None):
        
        self.domains[domain] = IntentDeterminationEngine(
            tokenizer=tokenizer, trie=trie)
1087447
public function newRecord($domain, array $parameters)
    {
        $this->checkParameters($parameters);

        return $this->processQuery(
            $this->buildRecordsQuery($domain, null, RecordsActions::ACTION_ADD, $parameters)
        );
    }
544842
public function keyCheck($apiKey = null, $url = null)
    {
        if ($apiKey === null || $url === null) {
            throw new InvalidArgumentException('Both apiKey and site URL cannot be null');
        }

        return $this->connection->keyCheck($apiKey, $url);
    }
1042181
private function addOptionalQueryParameters($apiKey, $language, $region)
    {
        if ($apiKey) {
            $this->endpoint = $this->buildQuery('key', $apiKey);
        }

        if ($language) {
            $this->endpoint = $this->buildQuery('language', $language);
        }

        if ($region) {
            $this->endpoint = $this->buildQuery('region', $region);
        }
    }
295697
public function addDKIM(string $privateKey, string $domain, string $selector): void
    {
        $signer = new DKIMSigner();
        $signer->privateKey = $privateKey;
        $signer->domain = $domain;
        $signer->selector = $selector;
        $this->set($signer);
    }
836859
public function trackPage($page = null, $title = null, $type = self::TYPE_PAGEVIEW)
	{
		if (!defined('self::TYPE_'. strtoupper($type))) {
			throw new AnalyticsArgumentException('Type variable can\'t be of this type.');
		}

		$item = "ga('send', 'pageview');";

		if ($page !== null || $title !== null) {
			$page = ($page === null ? "window.location.href" : "'{$page}'");
			$title = ($title === null ? "document.title" : "'{$title}'");
			$item = "ga('send', { 'hitType': '{$type}', 'page': {$page}, 'title': {$title} });";
		}

		$this->addItem($item);
	}
845730
protected function authenticateTrackingApi($tokenAuth)
    {
        $shouldAuthenticate = TrackerConfig::getConfigValue('tracking_requests_require_authentication');

        if ($shouldAuthenticate) {
            try {
                $idSite = $this->getIdSite();
            } catch (Exception $e) {
                Common::printDebug("failed to authenticate: invalid idSite");
                $this->isAuthenticated = false;
                return;
            }

            if (empty($tokenAuth)) {
                $tokenAuth = Common::getRequestVar('token_auth', false, 'string', $this->params);
            }

            $cache = PiwikCache::getTransientCache();
            $cacheKey = 'tracker_request_authentication_' . $idSite . '_' . $tokenAuth;

            if ($cache->contains($cacheKey)) {
                Common::printDebug("token_auth is authenticated in cache!");
                $this->isAuthenticated = $cache->fetch($cacheKey);
                return;
            }

            try {
                $this->isAuthenticated = self::authenticateSuperUserOrAdminOrWrite($tokenAuth, $idSite);
                $cache->save($cacheKey, $this->isAuthenticated);
            } catch (Exception $e) {
                Common::printDebug("could not authenticate, caught exception: " . $e->getMessage());

                $this->isAuthenticated = false;
            }

            if ($this->isAuthenticated) {
                Common::printDebug("token_auth is authenticated!");
            } else {
                StaticContainer::get('Piwik\Tracker\Failures')->logFailure(Failures::FAILURE_ID_NOT_AUTHENTICATED, $this);
            }
        } else {
            $this->isAuthenticated = true;
            Common::printDebug("token_auth authentication not required");
        }
    }
658629
def update_domain(self, domain, emailAddress=None, ttl=None, comment=None):
        
        return domain.update(emailAddress=emailAddress,
                ttl=ttl, comment=comment)
1358645
public function addDomain(Domain $domain)
    {
        $domain->setSite($this);

        $this->domains[] = $domain;

        return $this;
    }
127346
public function trackAction()
    {
        $this->settings['features']['anonymizeIP'] = intval((boolean)$this->settings['features']['anonymizeIP']);
        foreach ($this->settings['features']['track'] as $feature => $enabled) {
            $this->settings['features']['track'][$feature] = intval((boolean)$enabled);
        }

        // Crossdomain tracking
        $this->settings['crossdomain']['sub'] = intval($this->settings['crossdomain']['sub']);
        switch ($this->settings['crossdomain']['sub']) {
            case 0:
                $this->settings['crossdomain']['main'] = self::DOMAIN_NONE;
                break;
            case 1:
                $this->settings['crossdomain']['main'] = self::DOMAIN_AUTO;
                break;
            default:
                $mainDomain = $this->_getDomains($this->settings['crossdomain']['main']);
                $this->settings['crossdomain']['main'] = count($mainDomain) ? array_shift($mainDomain) : self::DOMAIN_AUTO;
                break;
        }
        $this->settings['crossdomain']['cross'] = $this->_getDomains($this->settings['crossdomain']['cross']);

        // Collecting custom variables (Google Analytics only)
        $customVariables = array();
        foreach ((array_key_exists('customVariables',
            $this->settings) ? (array)$this->settings['customVariables'] : array()) as $index => $variableKeyValue) {
            $index = intval($index);
            if (($index >= $this->_minIndex) && ($index <= $this->_maxIndex) && is_array($variableKeyValue)) {
                $customVariable = array('index' => $index, 'name' => null, 'value' => null, 'level' => null);
                foreach ($variableKeyValue as $key => $value) {
                    $value = is_array($value) ? $this->_getValue($value) : trim($value);
                    if (strlen($value)) {
                        $key = strtolower($key);
                        if (($key == 'name') || ($key == 'value')) {
                            $customVariable[$key] = $value;
                        } elseif (($key == 'level') && array_key_exists($value, self::$_levels)) {
                            $customVariable['level'] = self::$_levels[$value];
                        }
                    }
                }
                if (($customVariable['name'] !== null) && ($customVariable['value'] !== null) && ($customVariable['level'] !== null)) {
                    $customVariable['value'] = substr($customVariable['value'], 0,
                        63 - strlen($customVariable['name']));
                    $customVariables[] = array_values($customVariable);
                }
            }
        }

        // Collecting custom dimension & metrics (Universal Analytics only)
        $customDimensions =
        $customMetrics = array();
        foreach ((array_key_exists('customDimensions',
            $this->settings) ? (array)$this->settings['customDimensions'] : array()) as $dimension => $value) {
            if (preg_match("%^dimension\d+$%", $dimension)) {
                $customDimensions[$dimension] = is_array($value) ? $this->_getValue($value) : strval($value);
                if ($this->settings['removeEmptyCustomDimensions'] == 1) {
                    if (!strlen($customDimensions[$dimension])) {
                        unset($customDimensions[$dimension]);
                    }
                }
            }
        }
        foreach ((array_key_exists('customMetrics',
            $this->settings) ? (array)$this->settings['customMetrics'] : array()) as $metric => $value) {
            if (preg_match("%^metric\d+$%", $metric)) {
                $value = is_array($value) ? $this->_getValue($value) : strval($value);
                if (preg_match("%^\d+(\.\d+)?$%", $value)) {
                    $customMetrics[$metric] = floatval($value);
                }
            }
        }

        $this->settings['external']['track'] = min(2, max(0, intval($this->settings['external']['track'])));
        $this->settings['external']['prefix'] = $this->settings['external']['track'] ? trim($this->settings['external']['prefix']) : '';
        $this->settings['external']['track'] = strlen($this->settings['external']['prefix']) ? $this->settings['external']['track'] : 0;
        $this->settings['external']['restrict'] = json_encode($this->settings['external']['track'] ? $this->_getDomains($this->settings['external']['restrict']) : array());

        $this->settings['email']['track'] = min(2, max(0, intval($this->settings['email']['track'])));
        $this->settings['email']['prefix'] = $this->settings['email']['track'] ? trim($this->settings['email']['prefix']) : '';
        $this->settings['email']['track'] = strlen($this->settings['email']['prefix']) ? $this->settings['email']['track'] : 0;
        if ($this->settings['email']['track']) {
            $restrictEmails = array_map('trim',
                preg_split("%[\,\;\s\|]+%", trim($this->settings['email']['restrict'])));
            $this->settings['email']['restrict'] = array();
            foreach ($restrictEmails as $restrictEmail) {
                if (strlen($restrictEmail)) {
                    $this->settings['email']['restrict'][] = $restrictEmail;
                }
            }
            $this->settings['email']['restrict'] = json_encode($this->settings['email']['restrict']);
        } else {
            $this->settings['email']['restrict'] = array();
        }

        $this->settings['download']['track'] = min(2, max(0, intval($this->settings['download']['track'])));
        $this->settings['download']['prefix'] = $this->settings['download']['track'] ? trim($this->settings['download']['prefix']) : '';
        $this->settings['download']['template'] = $this->settings['download']['template'] ? trim($this->settings['download']['template']) : '{pathname}';
        $downloadFoldersExtensions = strlen(trim($this->settings['download']['list'])) ? explode(',',
            $this->settings['download']['list']) : array();
        $this->settings['download']['list'] = array();
        foreach ($downloadFoldersExtensions as $downloadFoldersExtensionsConfig) {
            $downloadFoldersExtensionsConfig = strlen(trim($downloadFoldersExtensionsConfig)) ? array_map('trim',
                explode('=', $downloadFoldersExtensionsConfig)) : array();
            if ((count($downloadFoldersExtensionsConfig) == 2) && strlen($downloadFoldersExtensionsConfig[0]) && strlen($downloadFoldersExtensionsConfig[1])) {
                $this->settings['download']['list'][$downloadFoldersExtensionsConfig[0]] = preg_split("%\s+%",
                    $downloadFoldersExtensionsConfig[1]);
            }
        }
        $this->settings['download']['track'] = (strlen($this->settings['download']['prefix']) && count($this->settings['download']['list'])) ? $this->settings['download']['track'] : 0;
        $this->settings['download']['list'] = json_encode($this->settings['download']['list']);

        $this->settings['direct']['keywords'] = json_encode(GeneralUtility::trimExplode(',',
            implode(',', preg_split("%[\,\;]+%", $this->settings['direct']['keywords'])), true));
        $this->settings['direct']['referrers'] = json_encode(GeneralUtility::trimExplode(',',
            implode(',', preg_split("%[\,\;]+%", $this->settings['direct']['referrers'])), true));

        $searchEngines = preg_split("%[\,\;]+%", $this->settings['searchengines']);
        $this->settings['searchengines'] = array();
        foreach ($searchEngines as $searchEngine) {
            if (strlen(trim($searchEngine)) && preg_match("%^([^\=]+)\040*\=([^\!]+)(\!?)$%", trim($searchEngine),
                    $searchEngineDefinition)
            ) {
                $this->settings['searchengines'][] = array(
                    trim($searchEngineDefinition[1]),
                    trim($searchEngineDefinition[2]),
                    !!$searchEngineDefinition[3]
                );
            }
        }
        $this->settings['searchengines'] = json_encode($this->settings['searchengines']);

        $this->settings['linkid']['enable'] = intval($this->settings['linkid']['enable']);
        $this->settings['linkid']['cookie'] = trim($this->settings['linkid']['cookie']);
        $this->settings['linkid']['duration'] = max(0, intval($this->settings['linkid']['duration']));
        $this->settings['linkid']['levels'] = max(0, intval($this->settings['linkid']['levels']));

        $user = trim($this->_getTypoScriptValue($this->settings['user']));

        $this->view->assign('customVariables', json_encode($customVariables));
        $this->view->assign('customDimensionsMetrics', json_encode(array_merge($customDimensions, $customMetrics)));
        $this->view->assign('pageUrl',
            $this->_getPageUrl(array_key_exists('pageUrl', $this->settings) ? $this->settings['pageUrl'] : null));
        $this->view->assign('user', strlen($user) ? $user : null);
        $this->view->assign('settings', $this->settings);

        return preg_replace('/[\R\s]*\R[\R\s]*/', '', $this->view->render());
    }
234542
private function updateDatafieldsByType($type, $email, $websiteId)
    {
        switch ($type) {
            case self::AUTOMATION_TYPE_NEW_ORDER:
            case self::AUTOMATION_TYPE_NEW_GUEST_ORDER:
            case self::ORDER_STATUS_AUTOMATION:
            case self::AUTOMATION_TYPE_CUSTOMER_FIRST_ORDER:
                $this->updateNewOrderDatafields($websiteId);
                break;
            case self::AUTOMATION_TYPE_ABANDONED_CART_PROGRAM_ENROLMENT:
                $this->updateAbandoned->updateAbandonedCartDatafields($email, $websiteId, $this->typeId, $this->storeName);
            default:
                $this->updateDefaultDatafields($email, $websiteId);
                break;
        }
    }
868506
@Trace(dispatcher = true)
	public Domain createReverseDomain(String name, Long templateId, String authorityType) throws GloboDnsException {
		NewRelic.setTransactionName(null, "/globodns/createReverseDomain");
		return this.createDomain(name, templateId, authorityType, true);
	}
965297
public function savePageDraft(
        UserInterface $user,
        string $pageName,
        string $pageType,
        $data,
        $urlToPageFunction,
        int $originalRevisionId
    ) {
        if (empty($user)) {
            throw new TrackingException('A valid user is required in ' . get_class($this));
        }

        $this->prepSaveData($data);

        $result = $this->pageRepo->savePage(
            $this->currentSite,
            $pageName,
            $originalRevisionId,
            $pageType,
            $data,
            $user->getId(),
            'Save existing page in ' . get_class($this),
            $user->getName()
        );

        /**
         * If the pageRepo deterimins there was no change, it saves nothing a returns and empty $resultRevisionId.
         */
        $savedANewVersion = !empty($result['newPageRevisionId']);

        if ($savedANewVersion) {
            $resultPageRevisionId = $result['newPageRevisionId'];
            /**
             * @var Page
             */
            $page = $this->pageRepo->findOneBy([
                'site' => $this->currentSite,
                'name' => $pageName,
                'pageType' => $pageType
            ]);

            $this->immuteblePageVersionRepo->createUnpublished(
                new PageLocator(
                    $this->currentSite->getSiteId(),
                    $this->rcmPageNameToPathname->__invoke($pageName, $pageType)
                ),
                $this->immutablePageContentFactory->__invoke(
                    $page->getPageTitle(),
                    $page->getDescription(),
                    $page->getKeywords(),
                    $this->revisionRepo->find($resultPageRevisionId)->getPluginWrappers()->toArray()
                ),
                $user->getId(),
                __CLASS__ . '::' . __FUNCTION__
            );
        }

        /**
         * @var $container Container
         */
        foreach ($result['modifiedSiteWideContainers'] as $revisionId => $container) {
            $this->immutableSiteWideContainerRepo->publish(
                new SiteWideContainerLocator($container->getSiteId(), $container->getName()),
                new ContainerContent(
                    $this->immutablePageContentFactory->pluginWrappersToFlatBlockInstances(
                        $this->revisionRepo->find($revisionId)->getPluginWrappers()->toArray()
                    )
                ),
                $user->getId(),
                __CLASS__ . '::' . __FUNCTION__
            );
        }

        if ($savedANewVersion) {
            $return['redirect'] = $urlToPageFunction(
                $pageName,
                $pageType,
                $resultPageRevisionId
            );
        } else {
            $return['redirect'] = $urlToPageFunction(
                $pageName,
                $pageType,
                $originalRevisionId
            );
        }

        return $return;
    }
1125213
public function add($tracking)
    {
        $sessionTracks = [];
        if (Session::has($this->sessionIdentifier)) {
            $sessionTracks = Session::get($this->sessionIdentifier);
        }

        //	prevent duplicates in session
        $trackingKey = md5($tracking);
        $sessionTracks[$trackingKey] = $tracking;

        Session::flash($this->sessionIdentifier, $sessionTracks);
    }