Site Implementation with Omniture Studio

After you have created a project and built it, you will be have an XML file and a DLL. These files are used in conjunction to configure your website for Omniture. First include a reference to the DLL in your web project. Now we can start adding it to pages. In many scenarios you will want include this on every page so we will work from this premise.

The first step is to get the generated Omniture web control on all pages. Assuming you have created a project with the name “MyProject”, you will include the strongly-typed DLL in your project and declare the webcontrol as follows on a page.

private TestProjectOmniturePlugin _plugin = null;

protected override void OnInit(EventArgs e)
{
	_plugin = new TestProjectOmniturePlugin();
	this.Controls.Add(_plugin);
}

public TestProjectOmniturePlugin OmniturePlugin
{
	get { return _plugin; }
}


After the webcontrol is added to the page it will need the configuration XML file that was generated with the DLL. In your “web.config” file place the key “OmnitureSiteConfiguration” in the appsettings section.

<add key="OmnitureSiteConfiguration" value="MyProject.xml"/>


That is all you need to do for Omniture to be present on your site. Now you need add the custom logic for on pages. These include button clicks, page loads, and other events that occur that you wish to track using the Omniture suite.

The following code shows how to add code to a button event to track necessary information. It is assumed that you have an Evar named “FirstName” and a Prop named “Location” and an event named “Purchase”.

this.OmniturePlugin.PageConfiguration.Evars.FirstName = "Chris"
this.OmniturePlugin.PageConfiguration.Props.Location = "GA"
this.OmniturePlugin.PageConfiguration.Events.Purchase = true;


That is all the code you need to do to set an Omniture Evar, Prop, and Event in code.

Last edited Sep 13, 2009 at 2:53 AM by codetools, version 1

Comments

No comments yet.