Support » Plugin: Greenhouse Job Board » Ad Google AdWords Conversion Tracking code

  • Resolved bsteinlo

    (@bsteinlo)


    Howdy!

    Using Cycle & Inline settings. I am using Google AdWords to generate traffic to my careers site. In order to fully track the candidates source and link it to the ad itself, you need to add a tracking code to the page you want to track (see https://support.google.com/adwords/answer/6331314?&hl=en_US).

    I want to add the Google AdWords Conversion tracking code to the ‘thank you’ page, this way I can draw a 1:1 that the ad led to a successful application. The tricky thing is because of Handlebars and the way the app is structured, the tracking code would appear on the entire page, I only want it to show if a successful application is sent.

    Is there a way to do this? I can add it to the ‘Thank You Body’ setting in WordPress but don’t think this is the proper route. Any suggestions?

    Thanks so much!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter bsteinlo

    (@bsteinlo)

    After doing a little research, would something like this work?

    function ajax_submit(formid, redirect){
    		var formData = new FormData( $(formid)[0]);
    		$.ajax({
    		    type: $(formid).attr('method'),
    		    url: $(formid).attr('action'),
    		    data: formData,
    		    async: false,
    	        cache: false,
    	        contentType: false,
    	        processData: false,
    	        enctype: 'multipart/form-data',
    	        mimeType: 'multipart/form-data', 
    	        formid: formid,
    		    success: function(data, textStatus, jqXHR) {
    		    	if (ghjb_d) console.log('success', textStatus, data, jqXHR, this.formid);
    		    	// thanks_message(this.formid);
    		    },
    		    error: function(jqXHR, textStatus, errorThrown) {
    			    if (ghjb_d) console.log('error', textStatus, errorThrown, jqXHR);
    		    },
    		    complete: function(jqXHR, textStatus) {
    		    	if (ghjb_d) console.log('complete', textStatus, jqXHR);
    		    	thanks_message(this.formid, textStatus);
    
    /* Conversion Tracking Start */
              var google_conversion_id = YOUR_CONVERSION_ID_HERE;
              var google_conversion_language = "en";
              var google_conversion_format = "3";
              var google_conversion_color = "ffffff";
              var google_conversion_label = "YOUR_CONVERSION_LABEL_HERE";
              var google_remarketing_only = false;
    
              $.getScript('//www.googleadservices.com/pagead/conversion.js');
    
              var image = new Image(1, 1); 
              image.src = "//www.googleadservices.com/pagead/conversion/YOUR_CONVERSION_ID_HERE/?label=YOUR_CONVERSION_LABEL_HERE&guid=ON&script=0";  
              /* Conversion Tracking End */
    
    		    	// if (redirect != null && redirect != undefined) {
    			    // 	window.location.href = redirect;
    			    // }
    		    },
    
    		});
    		return false;
    	}
    Thread Starter bsteinlo

    (@bsteinlo)

    Plugin Author brownbagmarketing

    (@brownbagmarketing)

    Hey @bsteinlo, yes what you have done here would be a good way to do it.

    We could add a submit hook for your js and then you’d just add your own code to that hook. That’d be the best way to do it, that hook would be called once the form is submitted. Any other hooks that would help out your funnel tracking?

    Ideally we give you the hooks you need so that you don’t have to edit the plugin code so nothing has to be merged when a new version of the plugin is released.

    Thread Starter bsteinlo

    (@bsteinlo)

    Hey, thanks for getting back to me!

    A submit hook for the JS would be ideal for that funnel tracking. I think that would be it.

    I just wasn’t sure if I could do the AdWords tracking basic tracking code, or how to go the async route. Any thoughts there?

    Thread Starter bsteinlo

    (@bsteinlo)

    For anyone else interested in this, I solved it by using the conversion tracking code for a button click. I then put this code into my page template

    <script type="text/javascript">
    	/* <![CDATA[ */
      goog_snippet_vars = function() {
        var w = window;
        w.google_conversion_id = your-conversion-tracking-id;
        w.google_conversion_label = "your-conversion-label";
        w.google_remarketing_only = false;
      }
      goog_report_conversion = function(url) {
        goog_snippet_vars();
        window.google_conversion_format = "3";
        var opt = new Object();
        opt.onload_callback = function() {
        if (typeof(url) != \'undefined\') {
          window.location = url;
        }
      }
    	  var conv_handler = window[\'google_trackConversion\'];
    	  if (typeof(conv_handler) == \'function\') {
    	    conv_handler(opt);
    	  }
    	}
    	/* ]]> */
    </script>

    and then I am firing the goog_report_conversion(); function on the ajax_submit complete request.

    • This reply was modified 4 years, 6 months ago by .
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Ad Google AdWords Conversion Tracking code’ is closed to new replies.