silverorange Code


Site.SiteAnalyticsModule
/Site/SiteAnalyticsModule.php at line 17

Class SiteAnalyticsModule

SwatObject
└─SiteObject
└─SiteApplicationModule
└─SiteAnalyticsModule

public class SiteAnalyticsModule
extends SiteApplicationModule

Web application module for handling site analytics and ad tracking

Copyright:
2007 silverorange
License:
http://www.gnu.org/copyleft/lesser.html LGPL License 2.1

Field Summary
protected boolean

$autoclean_uri

Whether or not to automaticlaly clean the inbound tracking id from URIs.

protected boolean

$autocreate_ad

Whether or not to automaticlaly create Ad objects for unknown inbound tracking ids.

protected string

$inbound_tracking_id

The name of the inbound ad tracking URI parameter.

Fields inherited from Site.SiteApplicationModule
app
Method Summary
void

cleanInboundTrackingUri(SiteAd ad)

Removes inbound ad tracking id from the URI and relocates to a clean URI.

void

clearAd()

Clears the tracked inbound ad from the current session.

protected SiteAd

createAd(string shortname)

Creates a new ad object with the given inbound tracking id.

array

depends()

Gets the module features this module depends on.

SiteAd

getAd()

Gets the tracked inbound ad for the current session.

void

init()

Initializes this analytics module.

protected void

initAd()

Reads inbound tracking ids from the request URI and saves a new ad referrer.

protected void

insertInboundTrackingReferrer(SiteAd ad)

Inserts a referrer for an inbound tracking id.

void

setAutocleanUri(boolean clean)

Sets whether or not inbound tracking ids should be automatically cleaned from URIs.

void

setAutocreateAd(boolean create)

Sets whether or not inbound ad tracking ids should automatically create Ad objects in the database.

void

setInboundTrackingId(mixed id, string the)

Sets the name of the URI parameter used for tracking inbound ads.

Methods inherited from Site.SiteApplicationModule
depends, init, provides

Field Detail

/Site/SiteAnalyticsModule.php at line 43

autoclean_uri

protected boolean $autoclean_uri = false

Whether or not to automaticlaly clean the inbound tracking id from URIs

Defaults to false.

See Also:
SiteAnalyticsModule::setAutocleanUri()

/Site/SiteAnalyticsModule.php at line 55

autocreate_ad

protected boolean $autocreate_ad = false

Whether or not to automaticlaly create Ad objects for unknown inbound tracking ids

Defaults to false.

See Also:
SiteAnalyticsModule::setAutocreateAd()

/Site/SiteAnalyticsModule.php at line 32

inbound_tracking_id

protected string $inbound_tracking_id = 'ad'

The name of the inbound ad tracking URI parameter

Defaults to 'ad'. Google Analytics users may want to change this to 'utm_source' or 'utm_campaign'.

See Also:
SiteAnalyticsModule::setInboundTrackingId()
SiteAnalyticsModule::cleanInboundTrackingUri()

Method Detail

/Site/SiteAnalyticsModule.php at line 136

cleanInboundTrackingUri

public void cleanInboundTrackingUri(SiteAd ad)

Removes inbound ad tracking id from the URI and relocates to a clean URI

Parameters:
ad - the inbound tracking ad to clean from the URI.

/Site/SiteAnalyticsModule.php at line 100

clearAd

public void clearAd()

Clears the tracked inbound ad from the current session


/Site/SiteAnalyticsModule.php at line 305

createAd

protected SiteAd createAd(string shortname)

Creates a new ad object with the given inbound tracking id

Parameters:
shortname - the inbound tracking id of the Ad.
Returns:
the newly created ad object. The Ad is not yet saved in the database.

/Site/SiteAnalyticsModule.php at line 119

depends

public array depends()

Gets the module features this module depends on

The site analytics module depends on the SiteSessionModule and SiteDatabaseModule features.

Returns:
an array of {@link SiteApplicationModuleDependency} objects defining the features this module depends on.

/Site/SiteAnalyticsModule.php at line 88

getAd

public SiteAd getAd()

Gets the tracked inbound ad for the current session

Returns:
the tracked inbound ad for the current session or null if there is no tracked inbound ad for the current session.

/Site/SiteAnalyticsModule.php at line 66

init

public void init()

Initializes this analytics module

Stores ad object in the session module and initializes ad database reference.


/Site/SiteAnalyticsModule.php at line 205

initAd

protected void initAd()

Reads inbound tracking ids from the request URI and saves a new ad referrer

If autoclean URI is specified, after the referral is logged, the inbound tracking id is removed from the URI through a relocate.


/Site/SiteAnalyticsModule.php at line 270

insertInboundTrackingReferrer

protected void insertInboundTrackingReferrer(SiteAd ad)

Inserts a referrer for an inbound tracking id

This is used to cout the number of site referrals for a particular tracking id.

Parameters:
ad - the inbound ad to track.

/Site/SiteAnalyticsModule.php at line 174

setAutocleanUri

public void setAutocleanUri(boolean clean)

Sets whether or not inbound tracking ids should be automatically cleaned from URIs

Parameters:
clean - optional. True if inbound tracking ids should be automatically cleaned from URIs and false if they should not. If set to true, the ad tracking id is removed from the URI and a relocate is performed.

/Site/SiteAnalyticsModule.php at line 190

setAutocreateAd

public void setAutocreateAd(boolean create)

Sets whether or not inbound ad tracking ids should automatically create Ad objects in the database

Parameters:
create - optional. True if unknown inbound ad tracking ids should automatically create an Ad object in the database and false if they should not.

/Site/SiteAnalyticsModule.php at line 157

setInboundTrackingId

public void setInboundTrackingId(mixed id, string the)

Sets the name of the URI parameter used for tracking inbound ads

Parameters:
the - name of the URI parameter used for tracking inbound ads. Example: 'utm_source'.

silverorange Code