Adding stored analytics tracking code to pages with an AdditionalPageHead delegate control

With the analytics tracking code being stored from the previous recipe, we will use an AdditionalPageHead delegate control to insert the snippet of analytics tracking code on each page.

Getting ready

For this recipe, we should already have the settings page created in the Storing analytics tracking code with a site collection settings page recipe.

How to do it...

Follow these steps to add the stored analytics tracking code with a delegate control:

  1. Open the project created in the Creating a Visual Studio solution for custom delegate controls recipe of this chapter in Visual Studio.
  2. Add a new class to our Controls folder.
  3. Set the access modifier of our new class ...

Get SharePoint 2013 WCM Advanced Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.