Background

This plugin lets you generate a media code (mc) from any URL parameters.

Media codes enable you to track campaigns without additional development work. Mapp Intelligence supports campaign tracking based on a single URL parameter. The plugin combines the values of several URL parameters and sends them as one media code. Other systems may use several parameters to describe a single campaign (e.g. the UTM parameters in Google). 

Methods and Properties

name

Get the name of the extension.

/**
 * @type {string}
 */
wtSmart.extension.campaign_mapper.name;
JS

version 

Get the version of the extension.

/**
 * @type {string}
 */
wtSmart.extension.campaign_mapper.version;
JS

config 

Set and get the current configuration of the extension.

  • parameter: Make up a list of the URL parameters, to generate the media code from. The order of parameters determines the composition of the media code. The order of the parameters attached to the URL is irrelevant.
  • separator: Defines the separator used between each value. Note: a point must be set here to automatically send the various values to the Mapp Intelligence campaign levels.
  • mediaCode: Define the media code to track as a Mapp Intelligence campaign. First, you must set it up as a campaign channel in the Mapp Intelligence marketing configuration.
  • replacerRegExp: Filter out parts from the value of the URL parameter.
  • replacerValue: Enter a string to replace the located term.
  • findAllParameter: If this parameter is set to "true", only one campaign will be created if all defined URL parameters are found. The value "false" also only creates one campaign, if only single parameters are found. This means that in the third definition ("wt_camp"), a campaign parameter will also be created if only a, b and f are attached to the URL. The parameter would appear as wt.campaignId="[a].[b]....[f]"; setting the points ensures that the campaign values can be correctly assigned to the Mapp Intelligence campaign tree.
/**
 * @param {{
 *      parameter: string[],
 *      separator: string,
 *      mediaCode: string,
 *      [replacerRegExp=/^(?:)$/]: RegExp
 *      [replacerValue=""]: string,
 *      [findAllParameter=false]: boolean,
 * }[]} [config]
 *
 * @returns {object}
 */
wtSmart.extension.campaign_mapper.config(config);
JS

isActivated 

Get the status, if the extension is enabled.

/**
 * @returns {boolean}
 */
wtSmart.extension.campaign_mapper.isActivated();
JS

activate 

Activate the extension.

wtSmart.extension.campaign_mapper.activate();
JS

deactivate 

Deactivate the extension.

wtSmart.extension.campaign_mapper.deactivate();
JS

Examples

URL with one URL parameter: http://www.website.com/?wt_mc=newsletter.2021-5.teaser

URL with several (3 in this case) URL parameters: http://www.website.com/?utm_source=newsletter&utm_campaign=2021-5&utm_content=teaser

URL Example

URL: www.my-destinationpage.com?abc=my.source&def=my.campaign&ghi=my.medium&jkl=my.time

Campaign ID: wt_mc%3Dmy_source.my_campaign.my_medium.my_time

Code Example

// is campaign mapper activated
var isActivated = wtSmart.extension.campaign_mapper.isActivated();

// set campaign mapper config
wtSmart.extension.campaign_mapper.config([{
    parameter: ['abc', 'def', 'ghi', 'jkl'],
    separator: '.',
    mediaCode: 'wt_mc',
    replacerValue: '.',
    replacerRegExp: /_/g,
    findAllParameter: true
}]);

// get campaign mapper config
var campaignMapperConfig = wtSmart.extension.campaign_mapper.config();

// activate campaign mapper
wtSmart.extension.campaign_mapper.activate();

// deactivate campaign mapper
wtSmart.extension.campaign_mapper.deactivate();
JS