Hi
I have a use case where I want to pass custom event along with out of the box exit link which is getting tracked. E.g. I want 'event1' to be populated with exit link call along with 'eVar3'
All the configuration in DTM via DTM UI like I have 'Track outbound links' option checked and I have my filters specified in UI which are working as expected.
Any pointers?
'Thanks
Pankaj
Solved! Go to Solution.
In response to @aseelund's post:
Creating an Event Based Rule instead of adding code in the Adobe Analytics Tool config is a viable option, however, I do not recommend using _satellite.isOutboundLink(), for the following reasons:
So, if you want to go the Event Based Rule route, you should skip the bit about _satellite.isOutboundLink() and instead modify the Property = Value regex condition to include domains you do not want to track as exit links.
For example:
Property: href
Value: ^(?!.*(tel:|javascript:|mailto:|\.mysite\.com)).*
Though, depending on how long your internal domain list is (or if you want to avoid regex), you may want to instead do a custom code condition with something like this:
// list of values to match against to NOT trigger exit link tracking
// note that this is a substring match, which is how Adobe Analytics linkInternalFilters works
var internal = [
'tel:',
'javascript:',
'mailto:',
'.mysite.com'
];
var href=this&&this.href||'';
for (var d=0,l=internal.length;d<l;d++) {
if ( ~href.indexOf(internal[d]) ) return false;
}
return true;
DTM does not have a built-in configuration section for this, but you can do this with javascript code.
First, navigate to Overview > Adobe Analytics > Tool Config (gear icon)
Next, scroll down to Customize Page Code and click Open Editor
Next, add the following code in the code box:
s.usePlugins = true;
s.doPlugins = function(s) {
/* custom exit link tracking */
if (s.linkObject && s.linkURL && s.linkType == 'e') {
/* set variables to pop */
s.events = "event1";
// example: set s.eVar to target URL
s.eVar3 = s.linkURL;
/* make sure you register your events and eVars to linkTrackVars/linkTrackEvents! */
s.linkTrackVars = "events,eVar3";
s.linkTrackEvents = "event1";
} // end custom exit link tracking
} // end doPlugins
This code snippet enables and defines a callback function that gets called when a link is clicked (doPlugins gets called for a number of other scenarios, as well). The "custom exit link tracking" snippet within doPlugins is wrapped in a condition to qualify that a visitor just clicked an exit link
s.linkObject - A reference to the clicked html element on the page. It is good to check for the existence of this for standard html links on a page. However, you may need to remove this if you have custom code that triggers exit link tracking in other scenarios (uncommon).
s.linkURL - A reference to the clicked html element's href attribute. Same as above: you may need to omit this if you have custom code that manually triggers exit link tracking.
s.linkType - If a link (<a> element) was clicked, this indicates what type of link was clicked, based on your Link Tracking configuration. For links determined to be exit links, this value should be "e". Unlike the other two variables in the condition, this one should not be omitted. If you have other code that artificially triggers exit link tracking (e.g. something that ultimately makes a s.tl(true,'e','some value'); call, s.linkType should still have a value for you to check for (the 2nd arg in the s.tl call (even if it is DTM internally calling it from e.g. some Event Based Rule or Direct Call Rule vs. you directly making a s.tl call yourself))
Note: By default, Adobe Analytics does not wipe variables between s.t or s.tl calls on a given page, so they are effectively "cached" on a given page (as long as the "s" object exists on the page). However, you may have variables set on a page view that you do not want to "bleed over" to subsequent tracking calls on the page. To solve for this, there are two variables that you must "register" your events and variables you want to track in your link tracking (s.tl) call. Variables/events not "registered" to these variables are ignored and not included in the link tracking (s.tl) call.
s.linkTrackVars - A comma delimited list of the variables you want to include for link tracking. Note that the "s." namespace should not be included; only the variable name itself.
s.linkTrackEvents - A comma delimited list of the events you want to include for link tracking. In your scenario, this should be the same value as your s.events variable (sidenote: this isn't relevant to your scenario, but note you should only list the actual event[n] value in linkTrackEvents, not serialized/currency/numeric values added to them in s.events).
Also Note: This example assumes you have a basic implementation using default "s" object and do not have an existing s.doPlugins function defined. Make sure to alter your code accordingly! For example, you cannot have more than one s.doPlugins defined, so if it is already defined, add the exit link code to it.
We use a custom event rule instead of the out of the box handling.
1) disable (uncheck) the OotB adobe config
2) new event rule
3) condition must meet (_satellite.isOutboundLink === true)
(note in the condition, we create a var name %outboundLinkTarget% to collect the href value into an eVar)
4) set events, evars and props
[... more conditions ...]
______ Analytics ______
In response to @aseelund's post:
Creating an Event Based Rule instead of adding code in the Adobe Analytics Tool config is a viable option, however, I do not recommend using _satellite.isOutboundLink(), for the following reasons:
So, if you want to go the Event Based Rule route, you should skip the bit about _satellite.isOutboundLink() and instead modify the Property = Value regex condition to include domains you do not want to track as exit links.
For example:
Property: href
Value: ^(?!.*(tel:|javascript:|mailto:|\.mysite\.com)).*
Though, depending on how long your internal domain list is (or if you want to avoid regex), you may want to instead do a custom code condition with something like this:
// list of values to match against to NOT trigger exit link tracking
// note that this is a substring match, which is how Adobe Analytics linkInternalFilters works
var internal = [
'tel:',
'javascript:',
'mailto:',
'.mysite.com'
];
var href=this&&this.href||'';
for (var d=0,l=internal.length;d<l;d++) {
if ( ~href.indexOf(internal[d]) ) return false;
}
return true;
Thanks for all the very fast replies.
I think my predicament may have been slightly misunderstood. We are using isOutboundLink in DTM already but we are moving to Launch and it appears that Launch doesn't recognize it.
So we are looking for a way to do something similar in Launch.
I will look further into JoshD's response but if anyone has other ideas I am open.
Thanks again.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies