Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Insert code before BODY tagInsert code before BODY tag
Previous
 
Next
New Post
7/3/2007 7:15 PM
 

We would like to utilize a tracking script produced by SalesForce, and it requires that we place a couple of lines of code right before the <BODY> tag that calls a javascript on their site to track page access.

I placed the code at the bottom of a skin and applied it to a test portal. However, the portal inserts a couple of lines of code between the last code lines in the skin and the page's BODY tag... namely ScrollTop and VIEWSTATE input fields. Is there a way to place "footer" code so that it is directly before the BODY tag? I understand that the VIEWSTATE info is important for the portal to write changes, and don't necessarily want to remove that.

Suggestions?

 
New Post
7/4/2007 10:08 PM
 

For an HTML page to be valid, you cannot have arbitrary script before the <body> tag. It must appear within <script> ... </script> tags within the <head>..</head> section. This is accomplished by adding the script to the "Page Header Tags" field provided for this purpose (Page Settings > Advanced Settings > Appearance). However, this is of no use if the script has to be on every page, in which case your options are:

1) Modify default.aspx -- not good because it's not preserved when upgrading.

2) Inject the script programmatically.

3) Insert the script using <script>...</script> tags within your skin.

#3 is the simplest. It is very unusual for a tracking script to require such precise placement on a page as you have described. It's generally irrelevant where in the page it appears because all that the script is doing is updating a counter on a remote server. If you can provide some more details about the script, or share the code (minus your specific info), it'll be easier to recommend a solution.

Nik


Nik Kalyani
Co-founder
DotNetNuke Corporation
Blog | Twitter | FaceBook
 
New Post
7/4/2007 11:30 PM
 

I'm thinking he meant to say before the closing body (</body>) tag.

As Nik pointed out though, if you get it anywhere near the bottom of the page it's pretty certain that it will work.  There is most likely no need to worry about those couple of extra elements.

Most scripts like that will recommend putting it right before the closing body tag so that they don't have to worry about namespace collisions causing them support headaches.


DotNetNuke Modules from Snapsis.com
 
New Post
7/5/2007 4:47 PM
 

Yes, I did mean to say before the closing body tag (</BODY>). Here are the instructions:

  • Place the code snippet at the bottom of your web pages, just before the closing </BODY> tag
  • Make sure that the snippet is not inside any <TABLE>, <TR>, <SPAN>, <DIV> or other elements
  • Place the tracking code as far down the page as possible if other JavaScript is present on your pages
  • Placing the script at the bottom of the skin still means that the VIEWSTATE etc. code displays below the inserted script in the generated page code, which includes a </form> tag. Do you think this would be in violation of the instructions?

     
    New Post
    7/6/2007 11:11 AM
     

    Try it, and if it works you are good to go.

    They only tell you to put it down at the bottom so that their code will be more likely not to get messed up by some other code you stick in the page.


    DotNetNuke Modules from Snapsis.com
     
    Previous
     
    Next
    HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Insert code before BODY tagInsert code before BODY tag


    These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

    For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

    1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
    2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
    3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
    4. No Flaming or Trolling.
    5. No Profanity, Racism, or Prejudice.
    6. Site Moderators have the final word on approving / removing a thread or post or comment.
    7. English language posting only, please.
    What is Liquid Content?
    Find Out
    What is Liquid Content?
    Find Out
    What is Liquid Content?
    Find Out