Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
3 posts Page 1 of 1
Below is code that can easily be inserted in to the CMS to five you user the option to quickly and easily add their Google Analytics Code:

GLOBALS.PHP MODULE CODE
Code: Select all
      <cms:editable name='analyticsAndTracking' label='Analaytics and Tracking' type='group' /> 
         <cms:editable name='google_webamster_verification_code' label='Google Webmaster Verification Code' type='text'  group='analyticsAndTracking' ></cms:editable>
         <cms:editable name='ms_webamster_verification_code' label='Microsoft/Bing Webmaster Verification Code' type='text'  group='analyticsAndTracking' ></cms:editable>   
         <cms:editable name='googleAnalyticsCode' label='Google Analytics Code' type='text'  group='analyticsAndTracking' ></cms:editable>   
         <cms:editable name='googleAnalyticsDomain' label='Google Analytics Cookie Domain Name' type='text'  group='analyticsAndTracking' ></cms:editable>   
         <cms:editable name='googleAnalyticsCookieName' label='Google Analytics Cookie Website Name' type='text'  group='analyticsAndTracking' ></cms:editable>   
         <cms:editable name='googleAnalyticsCookieExpire' label='Google Analytics Cookie Expire Time' type='text'  group='analyticsAndTracking' >3600</cms:editable>


Below is the Google Analytics Code to be inserted into the body just under <body> tag:

GOOGLE ANALYTICS CODE
Code: Select all
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  ga('create', "<cms:get_custom_field 'googleAnalyticsCode' masterpage='globals.php' />", {
    'cookieDomain': "<cms:get_custom_field 'googleAnalyticsDomain' masterpage='globals.php' />",
    'cookieName': "<cms:get_custom_field 'googleAnalyticsCookieName' masterpage='globals.php' />",
    'cookieExpires': <cms:get_custom_field 'googleAnalyticsCookieExpire' masterpage='globals.php' />
  });
  ga('require', 'displayfeatures');
  ga('send', 'pageview');
</script>


Below is the code to be inserted in between he <head></head> tags to for Google Websmaster Verification andBing Webmaster Verification:

WEBMASTER CODE FOR HEAD
Code: Select all
    <meta name="google-site-verification" content="<cms:get_custom_field 'google_webamster_verification_code' masterpage='globals.php' />" />    
    <meta name="msvalidate.01" content="<cms:get_custom_field 'ms_webamster_verification_code' masterpage='globals.php' />" />   


I hope everyone finds this useful. :p

- Developernator
Hello @developernator,

How to find the values for all the editable regions that you have used?

Regards,
GenXCoders
Image
where innovation meets technology
Hi there! :)

Here is a link how to find your Google Analytics Id:
https://support.google.com/analytics/an ... 2385?hl=en

Here is a link on the Affinity Analytics:
https://support.google.com/analytics/an ... 9950?hl=en

You can get the Google Webmaster tag when you are completing the verification process when setting up the account:
https://support.google.com/webmasters/a ... 5179?hl=en

You get the Bing Webmaster tag when you sign with Bing Webmaster tools as well:
https://www.bing.com/webmaster/help/get ... t-66a806de

Cheers!
3 posts Page 1 of 1

Who is online

In total there are 5 users online :: 1 registered, 0 hidden and 4 guests
(based on users active over the past 5 minutes)

Users browsing this forum: cl and 4 guests