Expand my Community achievements bar.

Configuring Different Marketo Munchkin Code to specific site environments under Analytics extension


Level 1



Anyone had a chance to load unique Marketo munchkin code specific to environments under the Adobe Analytics extension code editor.


I need to load the unique munchkin code to the different environment. Like Sandbox Marketo Munchkin code to load only in DEV/QA/UAT site.and Production Marketo Munchkin code only in Live site.

1 Reply


Level 2

Hi @RoystonPr  ,

I dont think there is a way to do this in extension itself. You have to rely on custom code.

You can use custom code Adobe Launch rule action to set munchkin ID basis hostname/ URL as per your needs.

Below is sample code how you can achieve. Set Rule Event as "Core - DOM Ready" or "Core - Window Loaded" or "Core - Library Loaded" based on your need.(Any one event)

Set the action as a custom code with below code (Sample code needs to be fine tuned as per your needs. You will have to add hostname values along with Marketo ID and wsInfo value). I hope this helps!



//Define logic to set munchkin ID basis URL/ hostname
var munchkinId = "Your Default Production munchkin ID"
if(window.location.hostname === "Your Dev Website HostName"){
	munchkinId = "Dev Munchkin ID goes here";
else if(window.location.hostname === "Your Stage Website HostName"){
	munchkinId = "Stage Munchkin ID goes here";
//Munchkin script
(function() {
  var didInit = false;
  function initMunchkin() {
    if(didInit === false) {
      didInit = true;
      Munchkin.init(munchkinId, {"wsInfo":"abcd"});
  var s = document.createElement('script');
  s.type = 'text/javascript';
  s.async = true;
  s.onreadystatechange = function() {
    if (this.readyState == 'complete' || this.readyState == 'loaded') {
  s.onload = initMunchkin;