SOLVED

Re: How to configure Gmail Annotation in Email Script with Velocity Token. Looking for examples.

Go to solution
shelliezollin
Level 2
Hi!

I'm trying to add Gmail Annotation into a token via email script and haven't had much luck finding any examples.


I've added this script and token to the <head> of my email template, but I don't know what to add to the Email Script Token.

Sanford W had mentioned a Velocity Token, which I have researched, but haven't found any documentation on.
https://nation.marketo.com/t5/product-discussions/has-anyone-been-successful-in-adding-gmail-annotat... 

Can someone please assist?


Script added to the email template: 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">

<html>

  <head>

    <script type="application/ld+json">

   {{my.Gmail Annotation}}

    </script>

  </head>


Gmail Annotation script added to Email Script token which needs to be converted to Velocity Token: 

 

[{

           "@context": "http://schema.org/",

          "@type": "Organization",

           "@name": "Bank Name",

           "logo": "https://www.bank.com/images/app-fcb-logo.jpg"

}]

    

 

I'm looking for examples. If there's another way to add, perhaps in a snippet?
Any help is greatly appreciated. 

Marketo Email Scripting - https://developers.marketo.com/email-scripting/
More on Gmail Annotation: https://www.naomiwest.ca/journal/gmail-annotations-a-breakdown


Shellie Z
3 ACCEPTED SOLUTIONS
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

AFAICT, all the annotation content w/o the <script type="application/ld+json"> </script> tag should go in the email script token, which then is referenced in the email template within the script tag as per below - 

 

<head>
    <script type="application/ld+json">
   {{my.Annotation Content}} //email script token with Gmail Annotation
    </script>
</head>

 

You can reference this google doc on creating annotations. There are other annotations builder platforms as well, where you can add the content to a visual format and the configurator then generates the annotation code.

 

View solution in original post

shelliezollin
Level 2

Hi Darshil!

Your solution worked! 

 

Steps:

 

  • Add token {{my.Gmail Annotation}} before </head> in the email template.
  • Create {{my.Gmail Annotation} Email Script token in program and add all Gmail Annotation script
  • Test in Gmail


Shellie Z

View solution in original post

Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Yes - you need to add the script type (i.e., application/ld+json) in the  email template (as I’d mentioned in my earlier comment). Sorry if I’m missing anything else, but was there anything else that you’d to add? Thanks!

 

View solution in original post

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

AFAICT, all the annotation content w/o the <script type="application/ld+json"> </script> tag should go in the email script token, which then is referenced in the email template within the script tag as per below - 

 

<head>
    <script type="application/ld+json">
   {{my.Annotation Content}} //email script token with Gmail Annotation
    </script>
</head>

 

You can reference this google doc on creating annotations. There are other annotations builder platforms as well, where you can add the content to a visual format and the configurator then generates the annotation code.

 

Elsa_Man3
Level 2

 

Hello we followed these instructions but getting a Marketo error: Marketo does not allow javascript or script tags in email HTML
Please refresh your browser.

 

We added this script under the <head>

<script type="application/ld+json">
    {{my.googleannotation}}
</script>

 

The token:

[
{
"@context": "http://schema.org/",
"@type": "PromotionCard",
"image": "https://info.ticketinformationcs.com/rs/525-SZF-856/images/hrl-adl-23-1-1.10-image3-290px.png",
"url": "https://homelottery.com.au/grand-prize/"
},
{
"@context": "http://schema.org/",
"@type": "PromotionCard",
"image": "https://info.ticketinformationcs.com/rs/525-SZF-856/images/hrl-adl-23-1-1.10-image3-290px.png",
"url": "https://homelottery.com.au/"

},
]

 What are we doing wrong? it sounds like it does work for others. Appreciate any help, thanks in advance!

SanfordWhiteman
Level 10 - Community Moderator
Hi Elsa, when using VTL to skip other levels of validation, everything would have to be output from the token methinks.

P.S. Is anyone from your team at Summit?
Elsa_Man3
Level 2

Thanks for the swift reply Sanford! 

 

Does that mean we should have everything in the token itself? 

So this would all be in the email script token: 

<script type="application/ld+json">
[
{
"@context": "http://schema.org/",
"@type": "PromotionCard",
"image": "https://info.ticketinformationcs.com/rs/525-SZF-856/images/hrl-adl-23-1-1.10-image3-290px.png",
"url": "https://homelottery.com.au/grand-prize/"
},
{
"@context": "http://schema.org/",
"@type": "PromotionCard",
"image": "https://info.ticketinformationcs.com/rs/525-SZF-856/images/hrl-adl-23-1-1.10-image3-290px.png",
"url": "https://homelottery.com.au/"

},
]
</script>

 

And then in the email template, I'd just insert the token under the <head>

 

<head>
    {{my.googleannotation}}
</head>

 

And no unfortunately we won't be at the summit this year after all! Will you be attending? Would have been great to meet up.

shelliezollin
Level 2

Hi Darshil!

Your solution worked! 

 

Steps:

 

  • Add token {{my.Gmail Annotation}} before </head> in the email template.
  • Create {{my.Gmail Annotation} Email Script token in program and add all Gmail Annotation script
  • Test in Gmail


Shellie Z
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Great! Glad to be of help.

shelliezollin
Level 2

Hi again!

I thought this was working and I was wrong. The token is not locating the script. 
Would you mind taking a look?

This is what I added to the <head> in the email template: 

 

    <script type="application/ld+json">

   {{my.Gmail Annotation}}

    </script>

  


This is the json I added to the token email script:

 

[{
"@context": "http://schema.org/",
"@type": "Organization",
"logo": "https://landing.firstcitizens.com/rs/296-CPX-295/images/app-fcb-logo.jpg"
}]

    

 Can you see any errors?

Thank you!

Shellie Z
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Is your email asset created in a place in the Marketing Activities section that can reference the custom {{my.Gmail Annotation}} token? If the email is created in the design studio, then unless it is being sent by a smart campaign in Marketing Activities that can reference the token, it won't resolve on its own.

shelliezollin
Level 2

Hi, 

Thanks for your reply.

The <script> is in the Design Studio > Email Template <head>.

Yes, my email asset was created in Marketing Activites and the {{my.Gmail Annotation}} token has been added to the Email Program. I also tested the token at the folder level. 

Shellie Z
shelliezollin
Level 2

This is the solution:

 

This is what I added to the <head> in the email template: 

 

    <script type="application/ld+json">

   {{my.Gmail Annotation}}

    </script>

  


This is the json I added to the token email script:

 

{
"@context": "http://schema.org/",
"@type": "Organization",
"logo": "https://landing.firstcitizens.com/rs/296-CPX-295/images/app-fcb-logo.jpg"
}

I sent from a Smart Campaign. It took about a minute for the logo to show up in Gmail. 

 

 

Shellie Z
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Yes - you need to add the script type (i.e., application/ld+json) in the  email template (as I’d mentioned in my earlier comment). Sorry if I’m missing anything else, but was there anything else that you’d to add? Thanks!

 

shelliezollin
Level 2

Thank you Darshil_Shah1 - it's working correctly now. Thank you!

Shellie Z
Khyra
Level 3

Hi Shellie, 

Glad to read it worked for you-that means there's hope for me hehe! I keep on getting the following message when attempting to my velocity script token in my email (marketing activities) html:

 

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

 

Was this happening for you? 
mondo
Level 1

I am encountering the same error after attempting to use the token as well. I will admit I am rusty in my .html and completely new to JSON, but hoping some screenshots will help! I am just trying to annotate for a promotion in gmail.

 

My Token:

[{
"@context": "http://schema.org/",
"@type": "DiscountOffer",
"description": "15% Off!",
"discountCode": "LEARN2025",
"availabilityStarts": "START_2025-08-25",
"availabilityEnds": "END_2025-09-19"
}]

 

Here is it implemented in the email .html. Do I have it in the wrong place above the rest of my code?

mondo_0-1755794038050.png

 

SanfordWhiteman
Level 10 - Community Moderator

You can’t have two <html> tags or two <head>s, this is a very strange looking document.

SanfordWhiteman
Level 10 - Community Moderator

Can’t reproduce this. Can you show screenshots of the process you’re following? Just dropping the VTL {{my.token}} into the email works for me.