Google Analytics Redirect

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Locked
kendo451

Google Analytics Redirect

Post by kendo451 »

If you want to set up a landing page that redirects to your home page, but want to pass the Google Analytics url string here is a way to do it.

1. Create this UDT called pass_query_string

Code: Select all

// This UDT accepts the variable $url
// It will strip the page parameter out
// of the server QUERY_STRING
// And return the url with the query string

$gCms = cmsms(); //global $gCms;
$smarty =& $gCms->GetSmarty();

if ( isset($params['url'])){
$new_url = $params['url'] . '?' ;
}

$query = $_GET;

unset ( $query['page'] );

$new_url .= http_build_query( $query );

$smarty->assign('full_url' , $new_url );
2. Put this in your page template for the landing page - preferably in the <head>.

Code: Select all

{pass_query_string url='http://yoursite.com/home.htm'}
{redirect_url to=$full_url}
Locked

Return to “Tips and Tricks”