Re: How to insert Google Analytic Event tracking code in a Guided Marketo Landing Page?

Anonymous
Not applicable

How to insert Google Analytic Event tracking code in a Guided Marketo Landing Page?

Hello,

I came across in difficulties for inserting ga event tracking code in a marketo landing page. I have 3 different form & I want to track their activity.

I was trying something like below which seems not working.

<!-- EVENT TRACKING Download --> 

<script src="//app-ab06.marketo.com/js/forms2/js/forms2.min.js"></script>
  <form id="mktoForm_2745"></form>

<script>MktoForms2.loadForm("//app-ab06.marketo.com", "290-DNL-975", 2745, function(form) {
    form.onSuccess(function(values, followUpUrl) {
      ga('send', 'event', 'lead', 'trial', 'window.location.href');
      });
  });
  </script>
  <!-- EVENT TRACKING Download-->

May you kindly provide me the steps to do this.

Thanks

Gyan

15 REPLIES 15
Anonymous
Not applicable

Re: How to insert Google Analytic Event tracking code in a Guided Marketo Landing Page?

Are you not receiving anything in Google Analytics? Have you tried to debug the process line by line? Are you getting any error messages in the console when you do so?

Anonymous
Not applicable

Re: How to insert Google Analytic Event tracking code in a Guided Marketo Landing Page?

I also have a similar issue. What I've found by viewing the page source is that Marketo is converting our Google AdWords tracking code into HTML entities. We also have a guided landing page with a footer section that can be changed and code added that doesn't display as part of the page. The solution should be to allow this without converting to entities. What is happening is that the < > are getting converted to &lt; and &rt; so the script type and other declarations are not working properly.

How can we get tracking code to be inserted into a landing page without having these converted to HTML entities? Marketo is trying to help but instead it is just messing things up by converting these for us. I've treid converting these < > characters to entities before adding the code to the guided landing page but of course that doesn't help - we're not trying to display the code, we're trying to get the code itself into the page html.

Here's what's happening in my page source:

&lt;!-- Google Code for Download Conversion Page A --&gt; &lt;script type="text/javascript"&gt; /* &lt;![CDATA[ */ var google_conversion_id = 877836615; var google_conversion_language = "en"; var google_conversion_format = "3"; var google_conversion_color = "ffffff"; var google_conversion_label = "nJpfCJet82gQx_LKogM"; var google_remarketing_only = false; /* ]]&gt; */ &lt;/script&gt; &lt;script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"&gt; &lt;/script&gt; &lt;noscript&gt; &lt;div style="display:inline;"&gt; &lt;img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/877836615/?label=nJpfCJet82gQx_LKogM&amp;amp;guid=ON&amp;amp;script=0"/&gt; &lt;/div&gt; &lt;/noscript&gt;

SanfordWhiteman
Level 10 - Community Moderator

Re: How to insert Google Analytic Event tracking code in a Guided Marketo Landing Page?

If you are adding directly to the template, this should not be happening.  Are you using an interstitial {{lead.token}}?

Anonymous
Not applicable

Re: How to insert Google Analytic Event tracking code in a Guided Marketo Landing Page?

Not sure if this is the same issue Gyan is encountering, don't want to hijack the thread, but I think it is a very similar issue, because of the mention of "Guided Landing Page" rather than "Guided Landing Page Template."

I'm trying not to have to add code directly to the template - what is the point of having templates at all if they cannot be used for multiple landing pages? That's not the definition of a template. We have to create these new pages at the drop of a hat.

Currently in the <head> we have

<meta class="mktoString" id="gConversion" mktoName="Google AdWords Conversion" variable="${gConversion}">

and then in the <footer>

${gConversion}

Should we use mktoSnippet instead?

SanfordWhiteman
Level 10 - Community Moderator

Re: How to insert Google Analytic Event tracking code in a Guided Marketo Landing Page?

Yes, you should not use mktoText variables for HTML content.

Anonymous
Not applicable

Re: How to insert Google Analytic Event tracking code in a Guided Marketo Landing Page?

There isn't a mktoText variable; that is an element type/class: Understanding Elements and Variables in Guided Templates - Marketo Docs - Product Docs . You should be able to use HTML code in a mktoString variable it if you set the "allowHtml" attribute to true.

SanfordWhiteman
Level 10 - Community Moderator

Re: How to insert Google Analytic Event tracking code in a Guided Marketo Landing Page?

Yes, obviously I meant "mktoString," that was a typo. I forgot about allowHtml, though. Thanks!

At any rate mktoString variables are a highly questionable place to put a whole code block.

Anonymous
Not applicable

Re: How to insert Google Analytic Event tracking code in a Guided Marketo Landing Page?

Someone of your stature is not allowed to make such mistakes!

Anonymous
Not applicable

Re: How to insert Google Analytic Event tracking code in a Guided Marketo Landing Page?

What would be a less-questionable place to allow inserting a codeblock?