+44-7588 694076
RECENT BLOG ENTRIES
19 February 2012
Setting up IFD for Microsoft CRM 2011
A few tricks how to set up Internet facing deployment for Dynamics CRM 2011
Read full story
24 October 2011
Simple Twitter feed for the web-site
Very simple example how to put Tweeter feed on the web-site using .NET and LINQ.
Read full story
15 September 2011
Passing Referral into IFRAME in DotNetNuke
If you're unlucky to have IFRAMEs on your pages - here's how you could pass referrals for tracking purposes inside DotNetNuke
Read full story


Thursday, September 15, 2011

DotNetNuke, IFRAME and Omniture

Integrating things that were not initially supposed to be integrated - is always a lot of fun. I've been working for a while now on a customer's mission-critical web-site based on DotNetNuke 5.x. The whole front-end does not pose any significant problems as it's pretty much standard. However, the business logic (the sales mechanism) resides on different server and is displayed via IFRAME on the main web-site.

As much as I dislike IFRAME in the first place, in this particular case it could be justified by the universal nature of their LOB application making actual sales and the desire to split presentation layer from business logic.

Web analytics and intelligence is paramount for any online business and in this project the customer chose Adobe Omniture. The tracking code has been put on the business application page inside the IFRAME. Therefore all requests coming from referals landed on DotNetNuke page, having an IFRAME. The code inside the IFRAME detected the referral URL as the URL of the parent page that was clearly not right.

Passing referral URL in IFRAME in DotNetNuke

Small customization of DotNetNuke IFRAME module and Omniture tracking code is required to fix this problem.

First of all we need to pass the real referral URL from DotNetNuke page into the IFRAME. There are a lot of different ways to do that probably, the one I chose was to change a bit the source of this module. Basically we add an extra parameter to a collection of parameters that IFRAME module allows to pass through to IFRAME.

Dim objParam As New IFrameParameter 
objParam.ID = 1000 'actually arbitrary id
objParam.ModuleID = ModuleId objParam.Name = "Referrer" 
objParam.Type = IFrameParameterType.StaticValue 
If Request.Headers("Referer") <> "" 
Then objParam.TypeArgument = Request.Headers("Referer") 
End If 
colParams.Add(objParam)

This piece of code works in Iframe.ascx.vb located in DesktopModules/IFRAME. Just put it in Page_Load after these lines:

Dim strSource As String = Convert.ToString(Settings(Controller.Properties.Source)) 
Dim colParams As IFrameParameterCollection = (New Controller).GetParameters(ModuleId)

Now that we have a query string parameter inside the IFRAME page we can with very little effort utilize it thanks for the Omniture API. The Javascript code of Omniture allows overriding the referral URL by the user-defined this way:

if(s.getQueryParam('referral') 
s.referrer=s.getQueryParam('referral')

Being put along with other s.property the code fetches the query string parameter (if it exists) and overrides the wrong (parent page's) referral URL. As you can check yourself with Omniture debugger - it really substitutes the referral URL of the page.


Post a comment