Use doPlugins in the Adobe Analytics Extension

Last update: 2023-03-27
  • Created for:
  • Beginner

Learn to use Adobe Experience Platform Launch in order to have more control over your Adobe Analytics hits by leveraging the doPlugins capability.


Like to start today’s video by walking through a really powerful functionality that’s built into every implementation of Adobe Analytics that you may not even be aware of. That function is called doPlugins. I’ve actually already pulled up the knowledge base article that explains what exactly the doPlugins Function is and what it does. Simply, the doPlugins Function is a function that automatically is called after as a part of actually, every single call, every single server call, every single hit, every single page view, custom link, exit link, download link, no matter how it’s generated, as long as it’s generated by Launch by Adobe, then it’s going to call doPlugins. However, this is where things get interesting, doPlugins is not automatically included within your code. So you actually will need in Launch by Adobe, you will need to add a little bit of code into Adobe Launch in order to fire that within the Adobe Analytics Extension. So this session, this video will help explain how to do that. So the first place to go to is by starting with these code examples, as you can see, very simply, we’ve got some basic few lines of JavaScript to be added. And you can rename it if you want to, I don’t necessarily recommend that, unless you’ve renamed your S object and some examples of how to actually use it, some plugins etc. Now, the place that we’re going to be deploying this, is on the Adobe Analytics Insider Tour website. You can see here that when I load up the page, that we’re making a call to Adobe Analytics and we’re firing prop59 set to PV because it’s a page view. However, we’re also automatically capturing any clicks to external pages using automatic exit link tracking. For example, if I click here, which takes me to a different domain, then that opens a new tab and does properly make a call, which is an exit link and captures the URL that’s being exited to. However, prop59 is not being updated, because it’s still thinks it’s a page view. So we need to add some additional context and some additional code to the Adobe Analytics Extension in order to proactively identify, that this was actually an exit, not a page view. Let’s walk through how to do that.

As with all changes that you make an Adobe and Launch, I actually like to start by Creating a New Library. So we’ll call this the doPlugins Addition library. We’re going to send it to the dev environment, see if there’s any changes, looks like there is a minor change to our privacy extension. So I’ll Save and Build that for Development.

Now that, that’s built, I can choose that as my working library. So all changes that I make to launch will automatically be imported into that Dev Environment Library. So the first place that we wanna go is into the Adobe Analytics Extension. So we can click Configure, and there’s one very, very important checkbox to select, which is Make tracker globally accessible. If you click on the info button next to it, it’s simply informing us that it will make the S object available as window.s. I already have that checked within my implementation, if you don’t make sure that you do, as we’re going to be referencing that S object outside of the built in rules and with our own custom JavaScript. So, the place that we’ll actually be doing that is within this accordion panel here within the extension called Configure Tracker Using Custom Code. When I pop Open that Editor, you can see it’s currently blank. Now this is a very useful place to add some additional code. For example, if I wanted to automatically remove, cancel the call to Adobe Analytics, if for example, my page name has local host in it, which means it’s on my own personal testing environment, then I can actually set s.abort equals true and automatically that’ll be cancelled. However, this doesn’t fire with every single server call, it only fires on page view, it doesn’t fire with exit links and download links, custom links, etc., so we need to leverage doPlugins in order to expand upon that. So that’s one good use case for the custom code. However, it doesn’t resolve our prop59 issue. So what we’ll do is, we’ll start basically with this code that we see here listed in the knowledge base article. And I’ve actually already pre-built that here. So I can take that code and I’ve added one additional item. I’ve added a _satellite.logger.log that says doPlugins has been called. Now when I click Save, and then Save to Library and Build, when I refresh the page, I can then take a look and see that we now have doPlugins called which was the satellite logger log information that I sent within doPlugins. Now there’s a couple things to notice here. First of all, it is called in my console, also, it’s called on every single click that I make within my website. So that’s how often doPlugins is called. So you do wanna limit the extent and the size of the JavaScript that you include there. So you wanna make sure it’s optimized as often as possible. However, it’s extremely valuable in that it ensures that when I click on this button, doPlugins is going to be called. And however, that hasn’t fully resolved the issue, cause we haven’t updated prop59 to show that it was an exit link. So the way that we do that, is simply by taking some basic code, first of all, we can leverage what we call an Adobe Analytics Implementation Plugin. I’ve got a bunch of different useful plugins that are available, almost all of them are listed within the knowledge base as well. So you can see our installed plugins, for example, and you can leverage those in fact, here is the one that I’m using is an appendList plugin. So I’m gonna drop those appendList functions each of those into my area here outside of doPlugins. Now, the other thing I can do, is take advantage of those. So I can first, take a look at or first of all, is the current page a link? And that says if it’s, if it’s not undefined, which means that the current call to Adobe Analytics is a link, then we’re gonna set prop59 to the type of link that it is. Otherwise, if it’s not a link, then continue to set prop59 to PV or for page view. The other piece that we’ll wanna do is leverage the appendList code as well, so that regardless of what tag is actually firing, prop59 will always be included in that link. And so that combination of code within doPlugins, allows for us to Save it and Refresh that Library.

Now that our Library is updated, we can head back on over into our page, give the page a hard refresh.

And we’ll see a couple of different things. First of all doPlugins is still called and when I click, you’ll see the doPlugins is called again. However, an additional tag did not fire, we still have just the one, but if I click on that Click Here button, now we’re gonna see there’s a second tag fired and well up. Prop59 has been updated from PV to just simply E for exit link. I hope you found this walkthrough valuable of how to use doPlugins within Adobe Launch.

On this page