15 September 2011

If you're unlucky to have IFRAMEs on your pages - here's how you could pass referrals for tracking purposes inside DotNetNuke

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


RECENT BLOG ENTRIES
30 November 2013
Bigcommerce template editing
How to change content in BigCommerce.com templates: guide for a complete newbie.
Read full story
09 October 2013
What if Fancybox does not work at all
If Fancybox library does not work, this might be due to the conflicts with other JS libraries and not the syntax error.
Read full story
14 October 2012
Fancybox with ASP.NET form on Umbraco
Using ASP.NET form on Fancybox popup to make login window
Read full story

Blog archive

The author of this web-site supports WWF . Please do your part in saving our planet!

Alex’s expertise in developing and maintaining web applications has been invaluable to the College – J. Wittersheim, Director of Information Management and Funding, Bury College