Adding Custom Javascript to Your AMP Page

Follow

Adding Custom Javascript to Your AMP Page  

 

AMP pages do not support regular custom javascript.  AMP pages with custom javascript will not be validated as an AMP page. Instead, the AMP format has custom tags that are focused on resource loading and ensuring fast rendering of AMP web pages.

To find a library of these supported AMP components, please refer to Google’s AMP documentation.  Only use AMP components from this documentation when using the Add New Javascript dialog box for AMP pages.

To add AMP components to your AMP page follow the instructions below:

  1. Navigate to the page overview for the AMP page where you’d like to add your AMP component.
  2. Click on the Javascripts image2.png button in the bottom left-hand corner of the screen. A new dialog box will appear.
  3. Add the name for your new component to the Script Name blank field. Select the proper placement from the Placement drop-down menu according to the Google documentation.
  4. Paste the script into the blank field. Click the Save Code button at the bottom right-hand corner of the dialog box.
  5. Save and Republish your page.

Note:

 The following component scripts are already in use by the Unbounce Builder. Please do not duplicate as including them again will cause validation errors:

  • amp-analytics
  • amp-form
  • amp-iframe
  • amp-lightbox
  • amp-vimeo
  • amp-wistia-player
  • amp-youtube
Was this article helpful?
8 out of 25 found this helpful