Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End If/Else statement, different analytics code depending on URL Re: If/Else statement, different analytics code depending on URL

#67854
JaredAM
Member

There are a lot of different ways of doing this. PHP_SELF would be pretty safe for this:

Code:
$mypath = $_SERVER[“PHP_SELF”];

if (substr_count($mypath, “customer”) > 0) { // Catch customer

} elseif (substr_count($mypath, “documents”) > 0){ // Catch documents

} else { // Catch all

}