Amphtml: Support for Sendgrid's Universal Linking HTML attribute

Created on 23 Jul 2020  Â·  5Comments  Â·  Source: ampproject/amphtml

## Describe the new feature or change to an existing feature you'd like to see

The support of Sendgrid’s HTML attribute (universal=”true”) to facilitate the specific tokenization of Universal Links via Sendgrid in AMP HTML emails.

## Describe alternatives you've considered

Through our testing I was unable to find any alternatives that were compatible with AMP HTML. The current requirement to send AMP HTML emails is to have a ‘vanilla’ HTML backup variant in case the AMP HTML variant is not accepted by the user’s setting or Inbox Service Provider.

We are of course able to successfully send AMP HTML variants with normal hyperlinks but under no condition were we able to successfully have an AMP HTML variant with AMP elements to render when this specific attribute to denote a Universal Link was applied. On all attempts and variations, the fallback HTML variant was rendered in the inbox.

## Additional context

Through Sendgrid’s specific requirements Universal Links to work in a rendered email, this HTML attribute is added to hyperlinks as seen here:

<a href="links.example.com" universal="true">Link to your app!</a>

This will allow hyperlinks to go through their normal tokenization process for click tracking purposes but also append a /uni/ parameter to all of these tokenized links as in:

_https://email.appboy.com/uni/some_string_of_chars/some_hash_

This parameter is a requirement within Sendgrid’s configuration to then have each host’s AASA (iOS) and Assetlinks.json (Android) correctly interpreted and to then open the specific path in an application as designated by the Universal Link.

Feature Request

Most helpful comment

Yes, if the ESP is processing the HTML and updating href, I think it makes sense to also remove the non-standard universal=true attribute in that process. Alternatively, they can use a custom data attribute, e.g. data-universal=true instead of universal=true which is HTML-compliant and the AMP validator allows it.

All 5 comments

@ampproject/wg-amp4email

If I understand correctly, this universal=true attribute is not actually used in the email itself since it's non-standard, but is instead handled by SendGrid when preprocessing the email and before sending it, is that correct?

If so, I'm not sure what kind of support is needed here? This is handled by the ESP and not the email clients themselves.

universal=true does appear on <a> tags in the email itself, though the href is modified. Is the recommendation that the ESP should be removing the universal=true tag from their <a> tags? I just want to clarify that they don't currently do that, which prevents the otherwise valid AMP emails from working as expected.

Yes, if the ESP is processing the HTML and updating href, I think it makes sense to also remove the non-standard universal=true attribute in that process. Alternatively, they can use a custom data attribute, e.g. data-universal=true instead of universal=true which is HTML-compliant and the AMP validator allows it.

I can confirm that this solution works. Tested on iOS Gmail App.

Yes, if the ESP is processing the HTML and updating href, I think it makes sense to also remove the non-standard universal=true attribute in that process. Alternatively, they can use a custom data attribute, e.g. data-universal=true instead of universal=true which is HTML-compliant and the AMP validator allows it.

I have confirmed with the Sendgrid/Twilio team that they have pushed an update to allow data-universal=true to pass Universal Links and render in Amp Emails. I think we can close this out. Thank you @fstanis @adrianpratama-northstar

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aghassemi picture aghassemi  Â·  3Comments

aghassemi picture aghassemi  Â·  3Comments

radiovisual picture radiovisual  Â·  3Comments

westonruter picture westonruter  Â·  3Comments

edhollinghurst picture edhollinghurst  Â·  3Comments