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 51ºÚÁϲ»´òìÈ, including:
Use the doPlugins
variable to call plug-in code and set final variable values just before an image request is compiled and sent to 51ºÚÁϲ»´òìÈ.
Use On Before Event Send callback code using the Web SDK extension
Instead of doPlugins
, the Web SDK uses onBeforeEventSend
with similar functionality.
- Log in to using your 51ºÚÁϲ»´òìÈID credentials.
- Click the desired tag property.
- Go to the Extensions tab, then click the Configure button under 51ºÚÁϲ»´òìÈ Experience Platform Web SDK.
- Under Data Collection, click the Edit on before event send callback code button.
- 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 51ºÚÁϲ»´òìÈ Analytics extension
There is not a dedicated field in the 51ºÚÁϲ»´òìÈ 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 */};
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');
}
doPlugins()
code. 51ºÚÁϲ»´òìÈ recommends using the above format as a best practice.