Advanced Page Tagging Examples

Tagging a Link to non-HTML document

This link to a Excel document will send page tag data to the EMS page tag logs when the link is selected.
<a href="https://earthdata.nasa.gov/files/2012mmdd_SAMPLE_PageTagManifest.xls" onclick="return ntptLinkTag( this );">Word document</a>

Link to non-HTML document - no delay

This is the same Excel document as above, but it overrides the default 1 second delay in sending page tag data to EMS, and will send the data immediately upon selection.
<a href="https://earthdata.nasa.gov/files/2012mmdd_SAMPLE_PageTagManifest.xls" onclick="return ntptLinkTag( this, '', -1 );">same Word document</a>

Link to FTP site product - 2-second delay

This link to a FTP site data product will send page tag data to the EMS page tag logs when selected, waiting a maximum of two seconds to ensure the data is sent:
<a href="ftp://n4ftl01u.ecs.nasa.gov/SAN/GLAS/GLA01.033/2003.02.21/GLA01_033_1102_001_0087_4_01_BRWS_0001.1.jpg" onclick="return ntptLinkTag( this, '', 2.0 );">FTP site data product</a>

Mark Link to FTP Site as External/Exit Site

This is the same link to a FTP site data product as above, but it will mark the link as one to an external site:
<a href="ftp://n4ftl01u.ecs.nasa.gov/SAN/GLAS/GLA01.033/2003.02.21/GLA01_033_1102_001_0087_4_01_BRWS_0001.1.jpg" onclick="return ntptLinkTag( this, 'lk=1', 2.0 );">FTP site data product</a>
NOTE: The above designation allows links to external sites to be analyzed in the Link Summary but they are NOT tracked as a page view.

Mark a Link as an Event, not a Page View

This PDF document link is implemented as an event and NOT a page view.
<a href="https://earthdata.nasa.gov/files/TheEMSPageTagImplementationGuide.pdf" onclick="ntptEventTag('ev=PDFeventonly' );">PDF document link</a>

This is the same PDF link, also recorded as an event, NOT a page view, but it also sets a custom page tag paramenter with the name of the PDF document as its value.
<a href="https://earthdata.nasa.gov/files/TheEMSPageTagImplementationGuide.pdf" onclick="ntptEventTag('ev=PDFevent&PDFdocument=' + this.href );">same PDF link again</a>

Capturing Form Usage With Event Tagging

This example form POSTs to itself, which is invalid, but its intended to show how to use event tags to set up custom parameter key=value pairs to tag form fields and capture the values entered.

First, use the event tag ntptAddPair to add the custom page tag parameters to the standard page tag data transmitted:
<form name="myForm" method="post" onsubmit="ntptAddPair( 'myBox', this.myBox.checked ); ntptAddPair( 'myText', this.myText.value ); ntptAddPair( 'secondEntryField', this.secondEntryField.value ); ntptAddPair( 'myDelay', this.myDelay.value ); ntptAddPair( 'mySubmit', this.mySubmit.value ); return ntptSubmitTag( this, '&myFormSubmit=formSubmitted', parseFloat( this.myDelay.value ) );">
checkbox An onchange attribute is used to add the custom page tag parameter, myBoxChanged, and its value to the page tag data sent.
<input name="myBox" type="checkbox" onchange="ntptEventTag( 'myBoxChanged=1' );">
text box An onchange attribute is used to add the custom page tag parameter, myTextChanged, and its value to the page tag data sent.
<input name="myText" type="text" onchange="ntptEventTag( 'myTextChanged=1' );">
text box An onchange attribute is used to mark changes to this text box as an event (NOT a page view) and also adds the custom page tag parameter, secondTextField and its value to the page tag data.
<input type="text" name="secondTextField onchange="ntptEventTag( 'ev=field2ChangeEvent&secondTextField=' + encodeURIComponent( this.value ) );">
pull down selection This pull down selection menu sets the form submission delay time in seconds using the JavaScript parseFloat function. The value selected is also passed in a custom page tag parameter, myDelay.
submit button This form submit button will trigger a ntptSubmitTag() event set in the form onsubmit attribute. This sends the custom page tag parameters and entered values set in the form to the page tag log.