NetTalk Central

Author Topic: Google Analytics and the <head> tag  (Read 6254 times)

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Google Analytics and the <head> tag
« on: September 14, 2011, 12:33:07 AM »
Hi,

I need to add script in the <head> tag for Googly Analytics. I use the standard PageHeaderTag and though it could be placed in its XHTML section. But the <head> tag doesn't seem to be generated there. Where can I add the script so that it is placed in the <head> tag?

Thys

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: Google Analytics and the <head> tag
« Reply #1 on: September 14, 2011, 12:53:32 AM »
Ok - I figured it out. This script for Google Analytics can be added to the NetTalk extension template on the WebServer procedure under the Scripts tab. This is then listed as part of the standard scripts NT uses.

bijan

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • Email
Re: Google Analytics and the <head> tag
« Reply #2 on: September 17, 2012, 01:06:03 PM »
Hi,

I added the google.js in the webserver procedure and it does show on the site. Copied the file to the script folder. It has been over 2 days. However, Google account is not showing any activity. I understand the live option should show current visitors. It doesn't.

Any ideas?

Regards

Bijan

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Google Analytics and the <head> tag
« Reply #3 on: September 18, 2012, 04:33:11 AM »
what is your site URL?

Do you need to add more things to the page, other than just the link to google.js to make the analytics work?

bijan

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • Email
Re: Google Analytics and the <head> tag
« Reply #4 on: September 18, 2012, 07:37:35 AM »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Google Analytics and the <head> tag
« Reply #5 on: September 18, 2012, 07:42:47 AM »
>> Do you need to add more things to the page, other than just the link to google.js to make the analytics work?

bijan

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • Email
Re: Google Analytics and the <head> tag
« Reply #6 on: September 18, 2012, 09:25:25 AM »
No Bruce,

This js works just fine on the main site. www.americanairporter.com

<!-- Google Analytics tracking code-->
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-29134004-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

Larry Sand

  • Full Member
  • ***
  • Posts: 101
    • View Profile
Re: Google Analytics and the <head> tag
« Reply #7 on: September 18, 2012, 11:40:06 AM »
Since the analytics accounts are linked to a domain and you have two domains I don't think it'll work to just use the account number for the .com domain.

bijan

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • Email
Re: Google Analytics and the <head> tag
« Reply #8 on: September 18, 2012, 01:35:03 PM »
Hi Larry,

Thanks, this may help. There is an option for multiple top level domains when generating the tracking code. In addition, verification may be required for the tracking to be active. I have done both. It's recommended to wait 24 hours for all this to become active. Will let you know.
« Last Edit: September 18, 2012, 01:43:04 PM by bijan »

Larry Sand

  • Full Member
  • ***
  • Posts: 101
    • View Profile
Re: Google Analytics and the <head> tag
« Reply #9 on: September 19, 2012, 05:25:16 AM »
Bijan,

I haven't tried to configure an analytics account for multiple TLDs so it'd be great if you can post what you find out.  We do have our customers complete the verification process for analytics too.  Thanks.

bijan

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • Email
Re: Google Analytics and the <head> tag
« Reply #10 on: September 19, 2012, 01:01:21 PM »
Larry,

The js will be a little different if you choose TLD. There is even a check box for dynamic pages.

I created a separate index.html in the web folder and added the js there. It works on one domain with multiple subdomains or Multiple top-level domains.
However, when the JS is included in the header section of my webserver app, GA will not track my pages. I have frames for this webserver app and no index.html. I will try with a NT example app and will post the result. It will be next week.
« Last Edit: September 19, 2012, 01:07:50 PM by bijan »