Solved

Can I add Google Analytic script in Application.cfm?

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

777 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