The Metadata tag

Specifying meta information in the page is the second step of the integration. Jump to documentation about the installing tracker code if you don't have the tracker code running yet!

You can add the meta information to your pages in three different ways:

  • JSON-LD (recommended) - the metadata is included in a script tag and thus simplifies escaping of the content (most of the time the serving framework's JSON converter will suffice). Please note: our crawlers don't run javascript, so the contents have to be in the actual source of the page.
  • repeated metatags (alternative) - if the CMS you are using has a way to provide page information as meta tags in the page header, then this might be a more convenient option.
  • parsely-page (deprecated) - legacy proprietary format that represents metadata as JSON. This has now been replaced with JSON-LD. The crawlers will keep supporting this format but new projects should prefer JSON-LD.

The json-ld script tag is used to reliably identify information about the page, like the author, publishing date, title, and the section it belongs to. Add the tag to the <head> element of the tracked pages. The content parameter should be a JavaScript dictionary serialized to JSON.

<script type="application/ld+json">
      {
        "@context": "http://schema.org",
        "@type": "NewsArticle",
        "headline": "Zipf's Law of the Internet: Explaining Online Behavior",
        "url": "https://blog.parse.ly/post/57821746552",
        "thumbnailUrl": "https://blog.parse.ly/inline_mra670hTvL1qz4rgp.png",
        "dateCreated": "2013-08-15T13:00:00Z",
        "articleSection": "Programming",
        "creator": ["Alan Alexander Milne"],
        "keywords": ["statistics","zipf","internet","behavior"]
      }
</script>

Note on multiple authors

The json-ld script tag allows the specification of multiple authors for a single page. To do this, you can use the creator and contributor fields. Each of these fields may be specified as a single string containing one author's name. They may also be specified as an array of strings, one for each author's name.

<script type="application/ld+json">
           {
             "@context": "http://schema.org",
             "@type": "NewsArticle",
             "headline": "Zipf's Law of the Internet: Explaining Online Behavior",
             "url": "https://blog.parse.ly/post/57821746552",
             "thumbnailUrl": "https://blog.parse.ly/inline_mra670hTvL1qz4rgp.png",
             "dateCreated": "2013-08-15T13:00:00Z",
             "articleSection": "Programming",
             "creator": ["A. A. Milne", "John Kendall"],
             "keywords": ["statistics","zipf","internet","behavior"]
           }
</script>

Field description

@context The collection where the schema is defined. Always http://schema.org.
@type The specific schema being used. For post pages that you'd like Parse.ly to track, this should be NewsArticle. For non-post pages that you would not like Parse.ly to consider articles, this should be WebPage (see note below).
headline Post or page title (article headline)
url Canonical URL for post/page. For page groups like galleries, it should always point to the main article. For accurate data, the canonical urls for the social networks (link rel="canonical" and og:url) must match or resolve to this url. For more information, please refer to the documentation here.
thumbnailUrl URL of the image associated with the post/page
dateCreated Publication date, as ISO 8601 UTC timezone string
articleSection Section the page belongs to (e.g. "Politics")
creator Author of the post, provided either as a string or, for the multi-author posts, as a list.
keywords A list of tags associated with this post
metadata Arbitrary data to attach to post. Must be a valid JSON string. See documentation about custom metadata

Note

Parse.ly's JSON-LD model attempts to be as standards-compliant as possible while maintaining a high level of simplicity for implementers of Parse.ly metadata. With the exclusion of the metadata field, all of the fields supported by Parse.ly's JSON-LD model are valid under the schema.org metadata model. Thus, if you have marked a page with @type: WebPage to tell Parse.ly that it is not a post, the Parse.ly crawler will ignore the articleSection field, since articleSection is not a valid schema.org attribute of a WebPage. In fact, it's the only attribute Parse.ly uses that NewsArticle and WebPage don't share. Also, non-post pages (index, "hub," and section pages) can still be tracked in Parse.ly. As long as these pages are integrated properly with the JavaScript tracker, simply filter the "Page Type" in the dashboard either to "All Pages" or "Non-Post Pages" to see how they are doing.

Technical Caveats

Escape double quotes in JSON item values. Double quotes should be escaped with a backslash symbol like this: \".

Values in json-ld will appear literally inside Parse.ly Analytics. String values supplied here, specifically title, author, and section, will appear in Parse.ly analytics exactly as they are specifed in the tag. As a result, make sure to use proper capitalization and specify the values as you expect them to appear.

The json-ld script tag cannot be loaded asynchronously. The Parse.ly crawler will not execute JavaScript. It must be able to access the metadata tag from the results of a single GET request.

Do you have an urgent support question?