2 Replies Latest reply on Jun 1, 2018 2:34 PM by Chirag Agarwal

    Load pixel on Form Submit

    Chirag Agarwal

      We're trying to integrate LinkedIn Ad conversion pixel with our Marketo form which links to a PDF file as Thank you URL.

       

      The pixel tag is below:

      <img src="https://dc.ads.linkedin.com/collect/?pid=xxxx&conversionId=xxxx&fmt=gif" height="1px">

       

      Since LinkedIn tracks conversions based on number of times this pixel is loaded, is it possible to load this pixel only when the visitor hits Submit on the Marketo form?

       

      Any thoughts/ideas or better ways to track conversions with LinkedIn Ads would be appreciated!

        • Re: Load pixel on Form Submit
          Sanford Whiteman

          Actually "when the visitor hits Submit" is not when you want to load a conversion pixel. I see people make this mistake all the time and it totally mangles their conversion numbers.

           

          Hitting the Submit button doesn't mean the form was successfully submitted. Any validation error will reject the form, so you will get "conversion" after "conversion" and may not have a successful submission at all.

           

          What you want to do is catch the Success event.

           

          Like so:

           

          MktoForms2.whenReady(function(form){
            var liPixelSrc = "https://dc.ads.linkedin.com/whatever/the/img/url/is";
            form.onSuccess(function(vals,thankYouURL){
              var liPixel = new Image();
          
              liPixel.onload = function(e){
                document.location.href = thankYouURL;
              };
              liPixel.src = liPixelSrc;
          
              return false;
            });
          });
          
          1 of 1 people found this helpful