Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Can I add Google Analytic script in Application.cfm?

Posted on 2014-09-25
4
Medium Priority
?
105 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Create CentOS 7 Newton Packstack Running Keystone

A bug was filed against RDO for the installation of Keystone v3. This guide is designed to walk you through the configuration for using Keystone v3 with Packstack. You will accomplish this using various repos and the Answers file.

Question has a verified solution.

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

I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
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 tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

704 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