How to implement a Google Adwords “conversion pixel” using ajax on a submit button (no “thank you” page)

前端 未结 4 372
名媛妹妹
名媛妹妹 2020-12-08 15:30

I want to implement an adwords \"conversion pixel\" script - this is the script:




        
4条回答
  •  臣服心动
    2020-12-08 16:00

    function for creating iframe and put adwords code in thanks.php file

    function conversionTracker()  {
                    var  iframe = document.createElement('iframe');
                    iframe.style.width = '0px';
                    iframe.style.height = '0px';
                    document.body.appendChild(iframe);
                    iframe.src = 'thanks.php'; //Make sure path is correct! (update with bloginfo var for nebula)
                };
    call conversionTracker() in ajax success function
    ....
    success: function(response){
    conversionTracker();
    }
    

    then create a thanks.php file and put adwords code in this file

    
    
    
        
        
        Thank You
        
    
    
    
        
        
        
        
    
    
    

    Note : here label and conversion_id are fake values, Please put your own.

提交回复
热议问题