cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to insert javascript code into an iView?

Former Member
0 Kudos

Hi Everyone,

Is there a way to insert JavaScript code into an iView? I need to add some JavaScript code for WebTrends tagging in different URL iViews, AppIntegrator iViews etc. without having to programmatically adding it to the iView (i.e. opening up SAP's code and adding it in).

I looked at the iView level and did not see any place where I can insert it. Thanks in advance for your help.

Regards,

Abu

P.S. We are on EP 6 SP18

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

iView is just a visual representation of ur archives, par or ear files. I don't think u will have way to insert code in iView as such. This insertion can only be done via code.

Regards,

Harini S

Former Member
0 Kudos

Harini,

Thanks for your response. That's what I thought too, but wanted to check if anyone knew of a way to do it.

Abu

Answers (2)

Answers (2)

Former Member
0 Kudos

I have found a way of doing this. I customized the page layout and inserted the WebTrends tag (JavaScript) within. Then I used this layout on our Framework page and that propagated the WebTrends tag to all the portal pages. This enabled us to track every single portal page on the WebTrend server. I also switched to using the 'Short URL' on the portal, so that the page links of the Web Trend report looked better.

This is a better way of doing it instead of customizing each pages/iView.

Former Member
0 Kudos

Did you get the entries in the log file for all clicks throughout the portal, what if user is navigating the KM docs residing on a different application like microsoft CMS and portal iView is just displaying them. Do you get the most downloaded/uploaded file residing on portal KM and on different application like CMS? what about webDynpro iView on the portal, do you get the log entry for each click inside that iView? I appreciate for your response.

Thanks

Former Member
0 Kudos

Yes, it is capturing all the browsed pages on the logs. We use appIntegrator iViews for accessing legacy apps and 3rd party apps. In those cases, it only logs the first page. Also, the downloaded file (when clicked on a link within any page) is not being logged, which requires additional coding and was not a requirement for us. Hope this helps.

Abu Sadeq

Former Member
0 Kudos

Hi,

We've done the same task earlier, but generally focused on the top level navigation and some custom made iviews.

There might be a possible way to do it through a non-public API class I found IDocumentHookService .

I've yet to sit down and explore the possibilities, but I believe it could be used to add code to all iviews (though this might break alot of functionality).

Below is what I have of notes on it.

import com.sapportals.portal.prt.service.document.IDocumentHookListener;
import com.sapportals.portal.prt.service.document.IDocumentHookService;

Service
afterInit() 
        IDocumentHookService hookSrvc = (IDocumentHookService)context.getService("com.sap.portal.runtime.application.document.document");
        hookSrvc.addDocumentHook(this);


    public String doDocumentHook(int documentPosition, IPortalComponentRequest request)
    {
        switch(documentPosition)
        {
        case 4: // '004'
            return onHeadTagBegin(request);
        }
        return "";
    }

Former Member
0 Kudos

Hi Dagfinn,

Thanks for your response. I have awarded you some points.

Abu