Expand my Community achievements bar.

Adding variable to Analytics Extension Link Tracking

Avatar

Level 2

It's probably something really obvious that I've missed, but if you use the Adobe Analytics extension in Launch to enable automatic link and download tracking, is there a way of adding additional variables?

 

It's great being able to automatically track all this stuff, but not much use if you can't segment it down to particular pages / sections of the site.

 

Thanks!

2 Replies

Avatar

Community Advisor

I found my own unique way to do this... since I didn't see anything built into Launch.

 

Basically I used some of what I know from the old days when we had to create and manage our own AppMeasurement.js files.

 

In you analytics extension, go to Configure Tracker using Custom Code, and open the editor (you may already have code here, including some of the Adobe plugins... if you are using plugins, you should also have this:

 

 

 

s.usePlugins = true;
function s_doPlugins(s) {
  // code here
}

s.doPlugins = s_doPlugins;

 

 

 

If you don't we are going to use this (even without having plugins).

 

Basically, s_doPlugins is the last step of processing the beacon before it's sent.. so it's the perfect place to check for the automatic downloads and exit links.

 

 

 

s.usePlugins = true;
function s_doPlugins(s) {
  if (s.linkType === 'e') {
    s.events = "";
    s.linkTrackEvents = "";
    s.linkTrackVars = "";
  }
  else if (s.linkType === 'd') {
    s.events = "";
    s.linkTrackEvents = "";
    s.linkTrackVars = "";
  }
}
s.doPlugins = s_doPlugins;

 

 

 

Now you can populate what dimensions and events you want to be included on both your automatic exit links, and on you automatic download links.

 

  • s.events - add common separated events here; i.e. "event1,event2", if you have a serialized event, that also goes here "event1,event2,event3:12345"
  • s.linkTrackEvents - same as above, but you can't have serialization here; i.e. "event1,event2" or "event1,event2,event3" (odds are you don't need serialization, but if you ever need to code a custom action, this would be the way to do it)
  • s.linkTrackVars - comma separated list of dimensions you want included; i.e. "server,prop1,eVar1"

 

You may have to set your dimensions if they aren't already set, so you could do something like:

 

s.usePlugins = true;
function s_doPlugins(s) {
  if (s.linkType === 'e') {
    s.eVar1 = _satellite.getVar('data element name');
    s.events = "";
    s.linkTrackEvents = "";
    s.linkTrackVars = "eVar1";
  }
  else if (s.linkType === 'd') {
    s.eVar2 = _satellite.getVar('another data element');
    s.events = "";
    s.linkTrackEvents = "";
    s.linkTrackVars = "eVar2";
  }
}
s.doPlugins = s_doPlugins;

 

 

If you don't need to send events, then you can leave the s.events and s.linkTrackEvents right out of this code.

Avatar

Community Advisor

There is an undocumented trick where you can use the AA extension's "Set Variables" action to set whatever variables you want. But don't use a "Send Beacon" action. It works like this:

  1. Visitor clicks a link.
  2. Your rule with the "Set Variables" action runs to set whatever eVars, props, events, etc that you need.
  3. AA's automatic link tracking runs to track the download/exit link.

As you can see, this depends on the rule with that "Set Variables" action being able to run before AA's automatic link tracking kicks in. In my experience, this works flawlessly when the rule uses a regular "Click" event to detect the clicks.