Has anyone been successful in adding Gmail annotation to a Marketo email template? | Community
Skip to main content
Level 3
Aug 9, 2021 3:23 AM UTC
Solved

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

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.
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Aug 10, 2021 1:12 AM UTC

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.

16 replies

Level 9
Aug 11, 2021 11:31 PM UTC

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.

Translate
LillyFaAuthor
Level 3
Aug 17, 2021 3:48 AM UTC

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

Translate
SanfordWhiteman
Level 10
Aug 17, 2021 4:25 AM UTC
I would not use Microdata, which is outdated. (Google recommends JSON-LD over the alternatives). Continue using JSON-LD.
Translate
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Aug 10, 2021 1:12 AM UTC

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.

Translate
LillyFaAuthor
Level 3
Aug 11, 2021 6:23 AM UTC

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 🙂 

Translate
SanfordWhiteman
Level 10
Aug 11, 2021 6:37 AM UTC

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.

Translate
Employee
Aug 9, 2021 6:07 AM UTC

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

Translate
LillyFaAuthor
Level 3
Aug 11, 2021 6:24 AM UTC

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

Translate