Solved

Can I add Google Analytic script in Application.cfm?

Posted on 2014-09-25
4
55 Views
Last Modified: 2016-02-24
I like to add google analytics to all the pages of my web site.  it's written in ColdFuison.  Can I add Google Analytic script in Application.cfm?
0
Comment
Question by:adnank
  • 3
4 Comments
 
LVL 6

Expert Comment

by:rjohnsonjr
ID: 40344405
You can but you shouldn't.  It will make your html invalid because it will be before the opening html tag.
 
You could put it in a <cfsavecontent variable="gacode"></cfsavecontent> in your application file and then refeference it in your site by doing <cfoutput>#gacode#</cfoutput>

Another common option is to put it in a header.cfm or footer.cfm file and <cfinclude the file.
0
 

Author Comment

by:adnank
ID: 40344541
Can I create a "googleanalytic.cfm page and cfinculde in Application page.  Or it also make my html invalid.
0
 
LVL 6

Accepted Solution

by:
rjohnsonjr earned 500 total points
ID: 40344581
It would still make it invalid because it would show up above your <html> tag.

one what to handle it would be to do a search and replace for </head>  in your files and replace it with this:

<cfinclude template="googleanalytic.cfm"></head>

That should be easy enough.  Use a program like editplus or notepad++  to search / replace in all files.
0
 
LVL 6

Expert Comment

by:rjohnsonjr
ID: 40349687
What did you end up doing?
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now