Learn More





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...Administration ...Administration ...How to place custom code into HTML head section?How to place custom code into HTML head section?
New Post
1/7/2016 9:20 AM
I need to place a "custom" Google Analytics code into the head section of every page in a given portal. How can I do this?

Currently I place the script in an HTML/TEXT module present on all pages. After a conversation with Google Analytics support team, I was told I need to place the code in the head section for it to work properly.

There is a setting in DNN to do this by giving the analytics ID. I cannot use this feature because I need to provide a custom analytics code that works with the e-commerce solution on site. The script code is slightly different. I cannot use the autogenerated code from this feature.

Equally, I cannot use a Google Analytics module if I cannot change the code they insert.

As for placing it in the skin, I cannot find a way to access the head section of the page.

So please help. I have looked unline extensively and somewhat surprised that I still cannot find an answer to this which I imagine must be a common requirement.

New Post
1/7/2016 9:58 AM

You can inject code into the head of a page using the Page Settings > Advanced Settings > Page Header Tags

New Post
1/7/2016 10:38 AM
Thanks for the help. Yes I am aware of that and it works only for a single page. The site has 100s of pages so it is not feasible to add this one by one. Is there a way to do this for all pages on a site, including any new pages that might be created in the future?
New Post
1/7/2016 10:58 AM

You could use SQL to update all pages in your site to modify the Page Settings > Page Header Tags.

You could then create a new page template that has that code already entered in to the Page Header.

Alternatively, you might be able to use JavaScript to add the code in your skin instead
New Post
1/7/2016 11:13 AM

The Content Injection Module might work for you.   You can include it in on all pages easily.

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...How to place custom code into HTML head section?How to place custom code into HTML head section?

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.
Try Evoq
For Free
Start Free Trial
a Demo
See Evoq Live
Need More Information?