cancel
Showing results for 
Search instead for 
Did you mean: 

Magento loss adwords parameters

Magento loss adwords parameters

I have problem with adwords tracking, for some reason magento does not pass adwords' querystring (gclid). That is magento's issue is what Google told me. I followed a solution in this forum in here however it does not work out for me.

This is my current code snippet.

protected function _processRedirectOptions()
    {
        $isPermanentRedirectOption = $this->_rewrite->hasOption('RP');

        $external = substr($this->_rewrite->getTargetPath(), 0, 6);
        if ($external === 'http:/' || $external === 'https:') {
            $destinationStoreCode = $this->_app->getStore($this->_rewrite->getStoreId())->getCode();
            $this->_setStoreCodeCookie($destinationStoreCode);
            $this->_sendRedirectHeaders($this->_rewrite->getTargetPath(), $isPermanentRedirectOption);
        }

        $targetUrl = $this->_request->getBaseUrl() . '/' . $this->_rewrite->getTargetPath();

        $storeCode = $this->_app->getStore()->getCode();
        if (Mage::getStoreConfig('web/url/use_store') && !empty($storeCode)) {
            $targetUrl = $this->_request->getBaseUrl() . '/' . $storeCode . '/' . $this->_rewrite->getTargetPath();
        }

        if ($this->_rewrite->hasOption('R') || $isPermanentRedirectOption) {
			$queryString = $this->_getQueryString();
        	if ($queryString) {
            	$targetUrl .= '?' . $queryString;
        	}
            $this->_sendRedirectHeaders($targetUrl, $isPermanentRedirectOption);
        }
		$queryString = $this->_getQueryString();
        	if ($queryString) {
            	$targetUrl .= '?' . $queryString;
        	}
        

        $this->_request->setRequestUri($targetUrl);
        $this->_request->setPathInfo($this->_rewrite->getTargetPath());

        return $this;
    }

Do i do something wrong? I'm using magento 1.9.1. please help