1

I'm added a tracking link to New Shipment Email which will take customer to order tracking url. But I now have a requirement to utilize the Google's goto action for this purpose, so that customer could straight away goto the order tracking url without openeing the email.

How could I add the JavaScript

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "ParcelDelivery",
  "deliveryAddress": {
    "@type": "PostalAddress",
    "streetAddress": "24 Willie Mays Plaza",
    "addressLocality": "San Francisco",
    "addressRegion": "CA",
    "addressCountry": "US",
    "postalCode": "94107"
  },
  "expectedArrivalUntil": "2013-03-12T12:00:00-08:00",
  "carrier": {
    "@type": "Organization",
    "name": "FedEx"
  },
  "itemShipped": {
    "@type": "Product",
    "name": "iPod Mini"
  },
  "partOfOrder": {
    "@type": "Order",
    "orderNumber": "176057",
    "merchant": {
      "@type": "Organization",
      "name": "Bob Dole"
    }
  },
  "trackingUrl": "http://www.my-site.in/ordertracker/"
}
</script>

or Microdata

<div itemscope itemtype="http://schema.org/ParcelDelivery">
  <div itemprop="deliveryAddress" itemscope itemtype="http://schema.org/PostalAddress">
    <meta itemprop="streetAddress" content="24 Willie Mays Plaza"/>
    <meta itemprop="addressLocality" content="San Francisco"/>
    <meta itemprop="addressRegion" content="CA"/>
    <meta itemprop="addressCountry" content="US"/>
    <meta itemprop="postalCode" content="94107"/>
  </div>
  <meta itemprop="expectedArrivalUntil" content="2013-03-12T12:00:00-08:00"/>
  <div itemprop="carrier" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="FedEx"/>
  </div>
  <div itemprop="itemShipped" itemscope itemtype="http://schema.org/Product">
    <meta itemprop="name" content="iPod Mini"/>
  </div>
  <div itemprop="partOfOrder" itemscope itemtype="http://schema.org/Order">
    <meta itemprop="orderNumber" content="176057"/>
    <div itemprop="merchant" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Bob Dole"/>
    </div>
  </div>
  <link itemprop="trackingUrl" href="http://www.my-site.in/ordertracker/"/>
</div>

I deployed it using google app script with my own email (sender and receiver), it works fine

enter image description here

note:

I am aware the sender email should be authenticated by SPF/DKIM

I use my own gmail Id as sender (configured it with XAMPP (localhost))

receiver is the same gmail id.

2
  • It may help to have a look at how the guys from Meanbee did something similar: github.com/meanbee/gmailactions
    – Simon
    Commented Aug 2, 2014 at 15:25
  • yes I saw that but wasn't able to make it work with localhost. So just gonna try with the live server today. I'll update when done. Thank you.
    – Shathish
    Commented Aug 4, 2014 at 5:30

1 Answer 1

1

According to the Documentation https://developers.google.com/gmail/actions/getting-started you literally just put the JavaScript in the tag of the e-mail.

Like this example:

<html>
  <body>
    <script type="application/ld+json">
    {
      "@context":              "http://schema.org",
      "@type":                 "EventReservation",
      "reservationNumber":     "IO12345",
      "underName": {
        "@type":               "Person",
        "name":                "John Smith"
      },
      "reservationFor": {
        "@type":               "Event",
        "name":                "Google I/O 2013",
        "startDate":           "2013-05-15T08:30:00-08:00",
        "location": {
          "@type":             "Place",
          "name":              "Moscone Center",
          "address": {
            "@type":           "PostalAddress",
            "streetAddress":   "800 Howard St.",
            "addressLocality": "San Francisco",
            "addressRegion":   "CA",
            "postalCode":      "94103",
            "addressCountry":  "US"
          }
        }
      }
    }
    </script>
    <p>
      Dear John, thanks for booking your Google I/O ticket with us.
    </p>
    <p>
      BOOKING DETAILS<br/>
      Reservation number: IO12345<br/>
      Order for: John Smith<br/>
      Event: Google I/O 2013<br/>
      Start time: May 15th 2013 8:00am PST<br/>
      Venue: Moscone Center, 800 Howard St., San Francisco, CA 94103<br/>
    </p>
  </body>
</html>

For Magento you would just need to edit the Email template to include it. Possibly creating your own Module and calling that in order to easily set the variables.

To use your example

<html>
  <body>
    <script type="application/ld+json">
      {
        "@context": "http://schema.org",
        "@type": "ParcelDelivery",
        "deliveryAddress": {
          "@type": "PostalAddress",
          "streetAddress": "24 Willie Mays Plaza",
          "addressLocality": "San Francisco",
          "addressRegion": "CA",
          "addressCountry": "US",
          "postalCode": "94107"
        },
        "expectedArrivalUntil": "2013-03-12T12:00:00-08:00",
        "carrier": {
          "@type": "Organization",
          "name": "FedEx"
        },
        "itemShipped": {
          "@type": "Product",
          "name": "iPod Mini"
        },
        "partOfOrder": {
          "@type": "Order",
          "orderNumber": "176057",
          "merchant": {
            "@type": "Organization",
            "name": "Bob Dole"
          }
        },
        "trackingUrl": "http://www.my-site.in/ordertracker/"
      }
    </script>
    <p>
      Dear Bob,
    </p>
    <p>
      You order has shipped, <link> estimated delivery <whenever>
      <items table>
    </p>
  </body>
</html>
1
  • nope!, I already tried that. I din get it.
    – Shathish
    Commented Aug 1, 2014 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.