The s.tl() Function - Link Tracking

File downloads and exit links can be automatically tracked based
on parameters set in the AppMeasurement for JavaScript file.

If needed, these types of links can be manually tracked using custom
link code as explained below. In addition, custom link code can be used to
track generic custom links that can be used for a variety of tracking and
reporting needs.

s.tl() Parameter Reference

Variable

Description

this

The first argument should always be set either to this
(default) or true. The argument refers to the object being clicked; when set to
"this," it refers to the HREF property of the link.

If you are implementing link tracking on an object that has
no HREF property, you should always set this argument to "true."

Because clicking a link often takes a visitor off the
current page, a 500ms delay is used to ensure that an image request is sent to
Adobe before the user leaves the page. This delay is only necessary when
leaving the page, but is typically present when the
s.tl() function is called. If you want
to disable the delay, pass the keyword 'true' as the first parameter when
calling the
s.tl() function.

linkType

s.tl(this,linkType,linkName, variableOverrides, doneAction)

linkType has three possible values, depending on the type of
link that you want to capture. If the link is not a download or an exit link,
you should choose the Custom links option.

Type

linkType value

File Downloads

'd'

Exit Links

'e'

Custom Links

'o'

linkName

This can be any custom value, up to 100 characters. This
determines how the link is displayed in the appropriate report.

variableOverrides

(Optional, pass null if not using) This lets you change
variable values for this single call, It is similar to other
AppMeasurement libraries.

useForcedLinkTracking

This flag is used to disable forced link tracking for some
browsers. Forced link tracking is enabled by default for FireFox 20+ and WebKit
browsers.

Default Value

true

Example

s.useForcedLinkTracking = false

forcedLinkTrackingTimeout

The maximum number of milliseconds to wait for tracking to
finish before performing the
doneAction that was passed into
s.tl
. This value specifies the maximum wait time. If
the track link call completes before this timeout, the
doneAction is executed immediately. If
you notice that track link calls are not completing, you might need to increase
this timeout.

Default Value

250

Example

s.forcedLinkTrackingTimeout = 500

doneAction

An optional parameter to specify a navigation action to
execute after the track link call completes when
useForcedLinkTracking is enabled.

Syntax

s.tl(linkObject,linkType,linkName,variableOverrides,doneAction)

doneAction : (optional) Specifies the action to take after the link
track call is sent or has timed out, based on the value specified by:

s.forcedLinkTrackingTimeout

The
doneAction variable can be the string
navigate, which causes the method to set
document.location to the href attribute
of
linkObject. The
doneAction variable can also be a
function allowing for advanced customization.

If providing a value for
doneAction in an anchor
onClick event, you must return false
after the
s.tl call to prevent the default browser
navigation.

To mirror the default behavior and follow the URL specified
by the href attribute, provide a string of navigate as the
doneAction .

Optionally, you can provide your own function to handle the
navigation event by passing this function as the
doneAction.

Note: Uses of custom link code are often very specific to your Web
site and reporting needs. You can contact your Adobe Consultant or Customer
Care before implementing custom link code to understand the possibilities
available to you and how best to leverage this feature based on your business
needs.

The basic code to track a link using custom link code is shown in the
following example:

<a href="index.html" onClick="s.tl(this,'o','Link Name')">My Page</a>

Note: The s_gi function must contain your report
suite ID as a function parameter. Be sure to swap out
rsid for your unique report suite ID.

Note: If the link name parameter is not defined, the URL of the link
(determined from the "this" object) is used as the link name.

Using Function Calls with Custom Link Code
Due to the complex nature of custom link code, you can consolidate the code into a self-contained JavaScript function (defined on the page or in a linked JavaScript file) and make calls to the function within the onClick handler.

Popup Windows with useForcedLinkTracking
When useForcedLinkTracking is enabled, AppMeasurement overrides the default link behavior on some browsers to prevent the track link call from being canceled when the new page opens. AppMeasurement executes the track link call and handles the navigation event manually, instead of using the default browser action.

Links from URL Shorteners
Links from URL shortener services (such as bit.ly) are typically not tracked as page views or as referrers. These services return 301/302 redirects with the full URL to the web browser, which then sends a new, separate request to the full URL. The original referrer is preserved since the shortener is no longer in the loop, and there isn't an indication on the request that a redirect service was used to get the URL.