How to Implement Google Re-Marketing Tag in DTM?

To add the Google remarketing tag in DTM, the recommended approach is with a page load rule in DTM. Below is an example of the Google remarketing Tag. For more information on Google remarketing check out Google's documentation here

<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = XXXXXXXXX;
var google_custom_params = window.google_tag_params;
var google_remarketing_only = true;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/XXXXXXXXX/?value=0&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

To add the remarketing tag in DTM, complete the following: 

  1. Add a page load rule in DTM by going to Rules > Page Load Rules > Create New Rule
  2. Expand the JavaScript / Third-Party Tags section and add the following code in the Non-Sequential JS tab
  3. Save, Test, and Publish the Rule
Pastaba:

If you are deploying the remarketing tag async instead of using conversion.js, call conversion_async.js, then add additional coding to ensure the file loads before you reference it. More information on this approach in the Google documentation here

var dcJS = document.createElement('SCRIPT');
var done = false;
 
dcJS.setAttribute('src', '//www.googleadservices.com/pagead/conversion_async.js');
dcJS.setAttribute('type','text/javascript');
 
document.body.appendChild(dcJS);
dcJS.onload = dcJS.onreadystatechange = function () {
    if(!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {
         done = true;
         callback();
 
          // Handle memory leak in IE
          dcJS.onload = dcJS.onreadystatechange = null;
          document.body.removeChild(dcJS);
    }
};
function callback(){
     if(done){  
       /* <![CDATA[ */
       window.google_trackConversion({
         google_conversion_id : XXXXXXX,
         google_custom_params : window.google_tag_params,
         google_remarketing_only : true
       });
       //]]> 
     }
}

		
	





 Adobe

Gaukite pagalbą greičiau ir lengviau

Naujas vartotojas?

Adobe MAX 2024

Adobe MAX
Kūrybiškumo konferencija

Spalio 14–16 d. Miami Beach ir internetu

Adobe MAX

Kūrybiškumo konferencija

Spalio 14–16 d. Miami Beach ir internetu

Adobe MAX 2024

Adobe MAX
Kūrybiškumo konferencija

Spalio 14–16 d. Miami Beach ir internetu

Adobe MAX

Kūrybiškumo konferencija

Spalio 14–16 d. Miami Beach ir internetu