Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Can I add Google Analytic script in Application.cfm?

Posted on 2014-09-25
4
Medium Priority
?
110 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 2000 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

Prepare for an Exciting Career in Cybersecurity

Help prevent cyber-threats and provide solutions to safeguard our global digital economy. Earn your MS in Cybersecurity. WGU’s MSCSIA degree program curriculum features two internationally recognized certifications from the EC-Council at no additional time or cost.

Question has a verified solution.

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

Building a cohesive image for your brand is vital to making an impression on consumers. When the economy is tough, brands do better than unbranded  products. This can have a huge impact on your long-term profits, as the economy goes up and down.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
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.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

963 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