Solved

Can I add Google Analytic script in Application.cfm?

Posted on 2014-09-25
4
66 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

862 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

23 Experts available now in Live!

Get 1:1 Help Now