Add script tag to sharepoint masterpage RRS feed

  • Question

  • Hi

    I found code that give me statistics of sharepoint site,I want to put it on sharepoint master page in quick launch section under <Sharepoint:SPNavigationManager> tag,

    Can you help me I should add script tag in which Master page? And how I can do that?

    my desire code such as this:

    <!-- Begin StatisticsSite.ir Counter code -->

    <script type="text/javascript" language="javascript" src="http://www. StatisticsSite.ir/c.aspx?Code=1892987&amp;t=counter" ></script>

    <noscript><a href="http://www. StatisticsSite.ir/counter/stats.aspx?code=1892987" target="_blank">&#1570;&#1605;&#1575;&#1585;</a></noscript>

    <!-- End StatisticsSite.ir Counter code -->

    I’m very appriciated if anyone can help me.


    Friday, May 27, 2011 7:11 PM


All replies

  • I beleieve the issue is that the master page is cached so that it doesnt load every time a new user hits access the page and this causes the statistics to be off... However, you can always read from the IIS logs display the results in a  WebPart.








    Ivan Sanders My LinkedIn Profile, My Blog, @iasanders.
    Saturday, May 28, 2011 8:19 PM
  • luckstar,

    If you have choice of using third party solution, please have a look at Hit counter webpart available on CodePlex which logs the user visit count for entire site.

    Please do let me know if you need further info, thanks

    Best Regards, G Vijai Kumar | My Sharepoint Blog
    Tuesday, May 31, 2011 6:04 AM
  • Hello,

    Follow below link to get the master page location.


     Add following code in your master page:

    <SharePoint:ScriptLink language="javascript" name="script.js" runat="server"/>


    Thanks, Sandeep Pasham
    • Marked as answer by Ameneh.Maleki Tuesday, May 31, 2011 7:19 PM
    Tuesday, May 31, 2011 7:07 AM
  • @Ivan,

    Thanx for your answer, but I don’t have issue with this code, I ask for help about put this code in sharepoint Master Page.

    @Sandip Patil,

    Thanx for helpful link.


    Tahnx for your help, but this third party tools is not my desire, because it give me just who visit page, but I need for extra information such as how many users are online ?total of visitors of my site and …

    @Sandip Pasham,

    Thanx for helpful links,I put my java code in new content region(Right-click the page in Design view, and then click Manage Microsoft ASP.NET Content Regions on the shortcut menu.) by this , my java code appears in Master page and show my desire statistics of sharepoint site. Thanx a lot.

    Tuesday, May 31, 2011 7:19 PM