Has anyone been successful in adding Gmail annotation to a Marketo email template? | Community
Skip to main content
New Participant
August 9, 2021
Solved

Has anyone been successful in adding Gmail annotation to a Marketo email template?

  • August 9, 2021
  • 3 replies
  • 6072 views

Hi 

 

I'm new to the Marketo Community and not sure if this the best board to ask questions about Marketo email templates. 

 

We are a adding a new modular email template to Marketo with Gmail Annotations but getting this error message: 

"Marketo does not allow javascript or script tags in email HTML. Please refresh your browser."

 

Has anyone had a similar problem? Thank you 🙂

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

Yes, you can use Gmail Annotations in Marketo emails.

 

The problem is you're choosing the JSON-LD format for your annotations (which isn‘t the only format) and Marketo mistakenly thinks JSON-LD, which uses a <script> tag to create an HTML data block, is instead an executable script. In reality, it’s not executable and poses no security concern.

 

You can skip this check by adding the <script> tag to the <head> of the template and putting an Email Script {{my.token}} inside it.  The {{my.token}} contains the JSON.

3 replies

New Participant
August 11, 2021

The above solutions will work, but in the past I used the microdata format instead to get around this:

 

https://developers.google.com/gmail/markup/reference/formats/microdata

 

There might be drawbacks to this compared to the script option, but I haven't found them yet.

LillyFaAuthor
New Participant
August 17, 2021

Thanks @phillipwi1 ! Would you mind elaborating on how I could implement this solution? My knowledge of HTML is quite limited.

SanfordWhiteman
New Participant
August 17, 2021
I would not use Microdata, which is outdated. (Google recommends JSON-LD over the alternatives). Continue using JSON-LD.
SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
August 10, 2021

Yes, you can use Gmail Annotations in Marketo emails.

 

The problem is you're choosing the JSON-LD format for your annotations (which isn‘t the only format) and Marketo mistakenly thinks JSON-LD, which uses a <script> tag to create an HTML data block, is instead an executable script. In reality, it’s not executable and poses no security concern.

 

You can skip this check by adding the <script> tag to the <head> of the template and putting an Email Script {{my.token}} inside it.  The {{my.token}} contains the JSON.

LillyFaAuthor
New Participant
August 11, 2021

Amazing., thank you! I'll add the <script type="application/ld+json"> to a snippet inside the head tag and report back if have any issues.

 

I should have thought of this, especially as I'll need to edit some of the content periodically but wasn't sure if possible. I haven't had much luck with tokens, they are less flexible and a bit buggy (cannot determine which assets attached to).

 

Do you know if there are any best practices for coding HTML snippets? I have been using a bit of trial and error as cannot find any Marketo documentation or discussion about this. 

 

Thanks again! Your answers are always so helpful 🙂 

SanfordWhiteman
New Participant
August 11, 2021

I should have thought of this, especially as I'll need to edit some of the content periodically but wasn't sure if possible. I haven't had much luck with tokens, they are less flexible and a bit buggy (cannot determine which assets attached to).

Hmm, I wouldn’t say they’re buggy, tokens are kind of the lifeblood of a manageable Marketo instance!

 

It’s true that determining ‘Used By‘ isn’t possible, but you have to consider that in token-centric instances — which most complex Marketo instances are — you could be talking about 10,000+ assets referencing a {{my.token}}. So it wouldn’t be useful to see a list of the assets, since it would overflow any reasonable display.

 


Do you know if there are any best practices for coding HTML snippets? I have been using a bit of trial and error as cannot find any Marketo documentation or discussion about this. 

Not any practices that are different from coding HTML for email in general.

Employee
August 9, 2021

Hi @lillyfa 

I believe Marketo does not allow for <scripts> to be included into the HTML templates. This is more form a security risk point of view.

I am assuming your Gmail annotation has scripts - which is why you are receiving this error.

Thanks

Floyd

LillyFaAuthor
New Participant
August 11, 2021

Thank you so much for your help, Floyd! Yes it does 🙂