Compartilhar via


HitCounter Method

Applies to: SharePoint Foundation 2010

Generates a hit on a page containing a hit counter.

<Method ID="0,HitCounter">
  <SetVar Name="Cmd">HitCounter</SetVar>
  <SetVar Name="Page">URL</SetVar>
  <SetVar Name="Image">[0-4]</SetVar>
  <SetVar Name="Custom">URL</SetVar>
  <SetVar Name="Digits">Integer</SetVar>
</Method>

Parameters

Parameter

Description

ID = "Text"

Application-specific string. In an HTML editor compatible with Microsoft SharePoint Foundation, such as Microsoft Office SharePoint Designer 2007, the string provides the sequence number and name of the method.

Name = "Cmd"

Must be set to HitCounter.

Name = "Page"

Specifies the site-relative URL of the page containing the counter.

Name = "Image"

Optional. Specifies an integer between 0 (zero) and 4 representing one of the default images used for the counter in Microsoft Office SharePoint Designer 2007. This parameter excludes usage of the Custom parameter.

Name = "Custom"

Optional. Specifies the site-relative URL of a custom image file used for the counter. Specifying this parameter requires that the Image parameter is not specified.

Name = "Digits"

Optional. Specifies a fixed number of digits for the counter. For example, if the page has received 101 hits and 5 is specified for this parameter, the counter displays 00101; if 2 is specified for this parameter, the counter displays 01.

Decoded

<Method ID="0,HitCounter">
  <SetVar Name="Cmd">HitCounter</SetVar>
  <SetVar Name="Page">Lists/Announcements/AllItems.aspx</SetVar>
  <SetVar Name="Image">3</SetVar>
</Method>

Remarks

Because the HitCounter method writes out the actual binary data of the image, this method should be used in URL protocol and not in posts using the Batch and Method elements.