You are here

santianoCoreDoubleContainerSandwitch

Used by the following Containers: 
Variable Type: 
Custom Javascript
Looks at the GTM ids from prod, dev, and current + if santianoCoreWebsiteIsInProduction to know where we are and if there are issues with our current implementation of GTM without having to remember all ids by heart.
	function() {
var santianoCoreWebsiteIsInProduction = {{santianoCoreWebsiteIsInProduction}};
var santianoCoreCurrentGtmId = {{santianoCoreCurrentGtmId}};
var santianoCoreGtmDevId = {{santianoCoreGtmDevId}};
var santianoCoreGtmProdId = {{santianoCoreGtmProdId}};

if (santianoCoreGtmProdId == 'GTM-XXXXXXX') {
	// santianoCoreGtmProdId is not yet defined
  	return '#Issue :( santianoCoreGtmProdId undefined'
  
} else if (santianoCoreGtmDevId == 'GTM-XXXXXXX') {
	// santianoCoreGtmProdId is not yet defined
  	// Only 1 GTM container is assumed
  	return '#OK :) santianoCoreProdId: ' + santianoCoreGtmProdId;

// Now we consider we are in a doubleContainerSandwitch !!!
  // Double GTM Id 
  // Double Analytics 
  // 1 GTM Configuration JSON File managing everything
  // and versionned on two distinct environments
  
// - 1 santianoCoreGtmDevId
  	// the GTM id called by the website on its localhost, Dev, QA, ...
  	// calling the webanalytics tools in their Dev ID
  
// - 1 santianoCoreGtmProdId
  	// the GTM id called by the website in production, serious stuff ;)
  	// sending data to vendors
		// UA-XXXXX Prod - Real revenue and conversions without the devs
  		// Advertising tags
  
// To push the GTM Configuration JSON from Dev to Prod :

    // on gtmDev - Publish, export the JSON, download it
  	// on gtmProd - Import the downloaded JSON, Overwrite, Publish
  	
} else if (santianoCoreWebsiteIsInProduction == true) {

  	// we are on a production website
    if (santianoCoreCurrentGtmId == santianoCoreGtmProdId) {
        // expected setup with the double container sandwitch :
        return '#OK :) - GTM in Prod - Website in Prod';
      
    } else if (santianoCoreCurrentGtmId == santianoCoreGtmDevId) {
  		// We are calling the production website with the dev GTM environment.
      	// call your favorite dev and say hello :)
		return '#Issue :( - GTM in Dev - Website in Prod'; 

    } else {
      	// is the santianoCoreCurrentGtmId correct in the GTM setup ?
		return '#Issue :( - GTMId not recognized - Website in Prod';
	}
  
} else {
	// we are in a dev environment
	if (santianoCoreCurrentGtmId == santianoCoreGtmProdId) {
      	// Issue here as we call the Prod GTM id on the Dev Website
		return '#Issue :( GTM in Prod - Website in Dev';
      
	} else if (santianoCoreCurrentGtmId == santianoCoreGtmDevId) {
      	// Expected as I call GTM from a dev environment with the right GTM ID 
		return '#OK :) - GTM in Dev - Website in Dev';
      
	} else {
      	// the GTM id is not expected it seems...
		return '#Issue :( - GTMId not recognized - Website in Dev';
	}
}
}