Campaign Design API > Debugging the API

How to activate

CD API campaign development may require iterative code changes. To facilitate campaign developers Maxymiser provides:

  • Browser address bar commands
  • Browser console debugging interface

Please make sure you are an authorized user before trying these capabilities. You should be either logged in to Maxymiser UI, or added to Company IPs list.

URL parameters

Commands to the Maxymiser tag can be entered as URL parameters. All the supported out-of-the-box parameters can be set in the following format:

?mmcore.{name}={value}

URL example:

https://www.oracle.com/marketingcloud/products/testing-and-optimization/?search=google&mmcore.un=qa

Below are URL parameters available for the authorized users you may find useful:

?mmcore.un={utilities}

Enables a debugging tool on a site. The following values are applicable:

  • debug – campaign code debugging tool
  • qa – QA tool

These can be also stacked in one request as ?mmcore.un=debug,qa

Alternatively you can use browser's console to run the following command:

mmsystem.enableUtility( "{utility}" ); // requires page refresh

?mmcore.disabled=1

Disables Maxymiser for the current page view. Alternatively you can use browser's console:

mmsystem.disable(); // turn Maxymiser off in your browser mmsystem.enable(); // turn Maxymiser back on

?mmcore.cfgID=1

Switches to Sandbox configuration for the current page view without enabling the QA tool.

?mmcore.uat={custom attributes}

Passes the specified Custom Attributes' values to Maxymiser on a page. The value should be constructed in the following format and then encoded:

encodeURIComponent( 'Name1=Value1;Name2=Value2' );

Just use the returned value as the URL parameter value: ?mmcore.uat=Name1%3DValue1%3BName2%3DValue2

Console commands

Whenever you enable the debugging tool, a new object mmsystem.debug becomes accessible via browser's console.

This feature is available starting from CD API version 1.7 (mmapi.js version should be 1.7 as well). It can be used on pages with at least one CD API script or campaign.

Below you can find the list of available methods and properties.

mmsystem.debug.getResponses() → {Array<Object>}

Returns an array of JSON responses from Maxymiser Content Generator that arrived to the current page.

Code example

mmsystem.debug.getResponses();

mmsystem.debug.site() → {Object}

Returns an object where references to all site modules (available in the site scripts) are stored.

Code example

mmsystem.debug.site() .visitor.requestPage('T42HPBanner') .done(function() { console.log(mmsystem.debug.site().site.scope); });

mmsystem.debug.campaign( campaignName ) → {Object}

Returns an object where references to all site modules (available in the campaign scripts) are stored.

Parameters

Name Description Type
campaignName

Name of the campaign you would like to retrieve modules of. Is a required argument, because every campaign has its own scope and data space.

String

Code example

var t42 = mmsystem.debug.campaign('T42HPBanner'); if (t42.campaign.getData('isLoggedIn') === true) { t42.renderer.runVariantJs(); }

What if more than one CD API version exists on a page?

If you have campaigns / scripts of different CD API versions (e.g., 1.5 and 2.1) on the same page, mmsystem.debug becomes extended with both versions as its branches:

var t42SeenFlag = mmsystem.debug['1.5'] .campaign('T42HPBanner') .campaign.getData('campaignHasBeenSeen'); var t45SeenFlag = mmsystem.debug['2.1'] .campaign('T45NavPosition') .campaign.getData('campaignHasBeenSeen');