doPlugins

The doPlugins variable acts as a ‘last call’ to set values in your implementation. It is the ideal place to make calls to Plug-in methods and set any desired variables before an image request is sent. If usePlugins is enabled, it automatically runs just before any type of image request is compiled and sent to Adobe, including:

  • All page view (t()) calls
  • All link tracking (tl()) calls, including automatic download links and exit links

Use the doPlugins variable to call plug-in code and set final variable values just before an image request is compiled and sent to Adobe.

Use On Before Event Send callback code using the Web SDK extension

Instead of doPlugins, the Web SDK uses onBeforeEventSend with similar functionality.

  1. Log in to Adobe Experience Platform Data Collection using your AdobeID credentials.
  2. Click the desired tag property.
  3. Go to the Extensions tab, then click the Configure button under Adobe Experience Platform Web SDK.
  4. Under Data Collection, click the Edit on before event send callback code button.
  5. Place the desired code in the editor.

Use onBeforeEventSend manually implementing the Web SDK

Instead of doPlugins, the Web SDK uses onBeforeEventSend with similar functionality. See Modifying events globally in the Web SDK documentation for more information.

// Set the trackingCode XDM field to "New value"
alloy("configure", {
  "onBeforeEventSend": function(content) {
    content.xdm.marketing.trackingCode = "New value";
  }
})

Plug-ins using the Adobe Analytics extension

There is not a dedicated field in the Adobe Analytics extension to use this variable. Use the custom code editor, following AppMeasurement syntax.

s.doPlugins in AppMeasurement and custom code

Set the s.doPlugins variable to a function containing desired code. The function automatically runs when you make a tracking call.

s.doPlugins = function() {/* Desired code */};
IMPORTANT
Set a function to the doPlugins variable only once in your implementation. If you set the doPlugins variable more than once, only the most recent code is used.

Examples

// Set eVar1 to the web page's title
s.doPlugins = function() {
  s.eVar1 = window.document.title;
};

// Use the getPreviousValue plug-in (requires plug-in code outside the function)
s.doPlugins = function() {
  s.eVar1 = s.getPreviousValue(s.pageName,'gpv_pn');
}
NOTE
Previous versions of AppMeasurement had slightly different doPlugins() code. Adobe recommends using the above format as a best practice.
recommendation-more-help
b4f6d761-4a8b-4322-b801-c85b9e3be690