SOLVED

Re: Is it possible to apply GTM script into all Marketo LP at once?

Go to solution
nsoria1
Level 2

Is it possible to apply GTM script into all Marketo LP at once?

Hi team, hope you are doing well.

We have a GTM code (similar as the one described in this page: https://googletagmanagersolution.com/tracking-marketo-form-submissions-using-google-tag-manager/) and we would like to implement it into our Marketo Landing Pages Templates.

In order to do so, we think we need to modify the HTML code related to the LP template to apply it to all LP related.

 

We were wondering if there is a way to apply to all LP Templates (or a subset of them) at once and include that GTM code as default when new LP Templates are created.

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Is it possible to apply GTM script into all Marketo LP at once?

When you update a landing page template, all the corresponding landing pages draw that change and get updated accordingly upon approving them (they go in draft mode when their respective template is updated). This is because LP assets are derived and based on their respective landing page template. However, you can't replicate that for LP templates, you'd have to make updates to all LP templates individually.

View solution in original post

8 REPLIES 8
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Is it possible to apply GTM script into all Marketo LP at once?

When you update a landing page template, all the corresponding landing pages draw that change and get updated accordingly upon approving them (they go in draft mode when their respective template is updated). This is because LP assets are derived and based on their respective landing page template. However, you can't replicate that for LP templates, you'd have to make updates to all LP templates individually.

nsoria1
Level 2

Re: Is it possible to apply GTM script into all Marketo LP at once?

Thank you. I wanted to validate that LP templates can't be updated at once with the code.

SanfordWhiteman
Level 10 - Community Moderator

Re: Is it possible to apply GTM script into all Marketo LP at once?


We have a GTM code (similar as the one described in this page: https://googletagmanagersolution.com/tracking-marketo-form-submissions-using-google-tag-manager/


Sorry, but I don‘t see how that page shows in any way (let alone correctly) how to track success events for a Marketo form.

nsoria1
Level 2

Re: Is it possible to apply GTM script into all Marketo LP at once?

Placing the google tag manager code should not cover the tracking of the activity?

SanfordWhiteman
Level 10 - Community Moderator

Re: Is it possible to apply GTM script into all Marketo LP at once?

Not at all. You need to write custom code to hook into the Forms 2.0 JS API to properly track Marketo onSuccess events.
nsoria1
Level 2

Re: Is it possible to apply GTM script into all Marketo LP at once?

Thanks @SanfordWhiteman - Is there any official documentation? Searching on Google I only found posts here. 

SanfordWhiteman
Level 10 - Community Moderator

Re: Is it possible to apply GTM script into all Marketo LP at once?

Like so:

MktoForms2.whenReady(function(readyForm){
  const formId = readyForm.getId();
  
  readyForm.onSuccess(function handleSuccess (submittedValues, thankYouHref) {
    window.dataLayer.push({
      "event": "mkto.form.success",
      "mkto.form.id": formId,
      "mkto.form.values": submittedValues,
      "mkto.form.followUpUrl": thankYouHref,
      "eventCallback" : function() {
        document.location.href = thankYouHref
      },
      "eventTimeout" : 2000
    });
    
    return false;
  });
});

 

Dave_Roberts
Level 10

Re: Is it possible to apply GTM script into all Marketo LP at once?

As Sanford mentioned, this update needs to happen at the template level for each template that you'd like to update.

 

However, it IS possible to have one template that does "all the things" in Marketo and populates all the different use-case-specific layouts you use throughout the entire instance. If you've got a flexible enough template that can suit every use-case then something like this is possible by just updating the universal template in one place and thereby updating all the pages in one place. 

 

It might also be worth mentioning that when you add the tracking script to your LP template and approve the template it'll kick your LPs in "Approved" status into the "Approved with Draft" status and you'll need to re-approve each page before the changes to the template are reflected on the live page.