Google Analytics
more_horiz
close

on 12th December 2017 / by antony.glen
In this article let us see how to use Google API with a simple example. Google API helps working with G-plus, Google Drive, Youtube etc. Google API files can be downloaded from this link https://github.com/google/google-api-php-client In this example, let's see how to get total views per URL for a site. First, we need to add the necessary library files to our project folder from the downloaded directory. For our purpose, we need only Google API source file, google-api-php-client/src/Google. Move the 'Google' directory to our project. Let's begin by adding the required files to our project from the library files. <?php require_once 'Google/autoload.php'; require_once 'Google/Client.php'; require_once 'Google/Service/Analytics.php'; ?>By including 'autoload.php' we could eliminate the worries of loading each and every class files individually. The files 'client.php and analytics.php' are the API dependencies. Next we need Google's API key which can be gained from https://console.developers.google.com. $client = new Google_Client(); $client->setApplicationName('Analytics Example'); $client->setClientId('CLIENT ID'); $client->setClientSecret('CLIENT SECRET'); $client->setRedirectUri('REDIRECT URL'); $client->setApprovalPrompt('auto'); $client->addScope("https://www.googleapis.com/auth/analytics.readonly");The above creates a client object for our app and adds basic config such as app name, client id, secret key, redirect URL. The setApprovalPrompt carries two values 'force' and 'auto'. Here we have used 'auto' option for this. Google ignores OAuth prompt for users who have been authorized before. We have set OAuth 2.0 scope to read-only mode. You can use scopes such us read-only, write, edit, also can add scope for view and manage permissions for analytics account etc. We will need an access token to perform the functionalities provided by the API client. Access token can be generated using calling API method 'getAccessToken()' using client object. In our code, we will be storing access token in a session variable for future use. If access token has been generated, let's try implementing API methods, the code will create an object '$gs_analytics' for class 'Google_Service_Analytics'. if ($client->getAccessToken()) { $gs_analytics = new Google_Service_Analytics($client); $_SESSION['access_token'] = $client->getAccessToken(); $ga_properties = $gs_analytics->management_webproperties->listManagementWebproperties("~all"); // Will return array with values account id, property id, website url etc. $ga_items = $ga_properties->getItems(); }Now let's check our final code, including the API query to fetch views count along with page URL. <?php session_start(); require_once 'Google/autoload.php'; set_include_path("../".PATH_SEPARATOR.get_include_path()); require_once 'Google/Client.php'; require_once 'Google/Service/Analytics.php'; define('GA_CLIENT_ID', 'xxxxx.xxx.xxxx'); define('GA_CLIENT_SECRET', 'xxxxx-xx-xxxx'); define('GA_REDIRECT_URL', 'xxxxxxxxxxxx'); $client = new Google_Client(); $client->setApplicationName('Analytics Demo'); $client->setClientId(GA_CLIENT_ID); $client->setClientSecret(GA_CLIENT_SECRET); $client->setRedirectUri(GA_REDIRECT_URL); $client->setApprovalPrompt('auto'); // Approval => [force/auto]. //Scope set as readonly. $client->addScope("https://www.googleapis.com/auth/analytics.readonly"); if (isset($_REQUEST['logout'])) { unset($_SESSION['access_token']); } if (isset($_GET['code'])) { $client->authenticate($_GET['code']); // Generates access token. $_SESSION['access_token'] = $client->getAccessToken(); $redirect_url_path = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; header('Location: ' . filter_var($redirect_url_path, FILTER_SANITIZE_URL)); } if (isset($_SESSION['access_token']) && $_SESSION['access_token']) { $client->setAccessToken($_SESSION['access_token']); } else { $auth_url = $client->createAuthUrl(); } ?> <?php if (isset($auth_url)): ?> <a href='<?php echo $auth_url; ?>'>Authenticate</a> <?php endif; ?> <?php if ($client->getAccessToken()) { $gs_analytics = new Google_Service_Analytics($client); $_SESSION['access_token'] = $client->getAccessToken(); $ga_properties = $gs_analytics->management_webproperties->listManagementWebproperties("~all"); $ga_items = $ga_properties->getItems(); if(is_array($ga_items)){ foreach ($ga_items as $key => $result) { $profile_data = $gs_analytics->management_profiles->listManagementProfiles($result->accountId, $result->id)->getItems(); echo '<a href="index.php?id=' . $profile_data[0]->id . '&domain=' . urlencode($result->websiteUrl) . '">' . $result->websiteUrl . '</a><br/>'; } } if (isset($_GET['id'])){ $page_results = $gs_analytics->data_ga->get( 'ga:'. $_GET['id'], //GA Property ID. date('Y-m-d',strtotime('-1 year')), date('Y-m-d',strtotime('-1 day')), // Restricts the results to specified date. 'ga:pageviews', //Gives page views count. array( 'dimensions' => 'ga:pagePath', 'sort' => '-ga:pageviews', 'max-results' => 50000, 'filters' => 'ga:medium==organic', )); if (is_array($page_results->getRows())) { print '<ol>'; foreach($page_results->getRows() as $page_val) { print '<li>'; print '<b>Pagepath</b> - ' . $page_val[0] . ', ' . ' <b>Visit</b>: ' . $page_val[1]; print '</li>'; } print '</ol>'; } } } ?>Our API could send total request of 50,000 per day. It is also restricted to 10 requests in a minute. This will list total views for a website, per page basis. Please contact for more information. Google Analytics Leave a reply Your email address will not be published. Required fields are marker *
close

on 24th November 2017 / by premshankar.pb
Google Analytics is a web analytics service provided by Google which tracks and reports website traffic. This is most widely used now. Continue reading the article for how to get the number of page views of your website using google analytics data. Getting the google analytics data To get some Google Analytics data for example the number of page views (API V3) first we should connect to API with the following code: $ga_token = "some_token"; $client = new Google_Client(); $client->setApplicationName("***"); $client->setClientId($client_id); $client->setClientSecret($client_secret); $client->setRedirectUri($redirect_uri); $client->setDeveloperKey($developer_key); $client->setScopes(array("https://www.googleapis.com/auth/analytics.readonly")); $client->setApprovalPrompt('force'); $client->setAccessType('offline'); $client->setAccessToken($ga_token);Then we take all accounts with their respective profiles (views): $service = new Google_Service_Analytics($client); $accounts = $service->management_accountSummaries->listManagementAccountSummaries(); $profiles = new stdClass(); foreach ($accounts->getItems() as $item) { foreach($item->getWebProperties() as $wp) { $views = $wp->getProfiles(); if (!is_null($views)) { foreach($wp->getProfiles() as $view) { $profiles->{$view['id']} = $view['name']; //get all the profiles } } } }Then we are going to check the page visits of page '/yourwebsite-path' in the site: "www.yourwebsite.com". $path = "/yourwebsite-path"; $host = "www.yourwebsite.com"; // this is the default params used for google analytics api call. $optParams = array( 'dimensions' => 'ga:pagePath,ga:source,ga:keyword', 'sort' => '-ga:sessions,ga:source', 'filters' => 'ga:medium==organic,ga:pagePath=='.$path.',ga:hostname=='.$host, 'max-results' => '25' ); $totalSessions = 0; //set the time period from today to one month back $today = date('Y-m-d', time()); $monthbefore = date('Y-m-d', (time() - (30 * 24 * 60 * 60))); foreach ($profiles as $profile_id => $profile) { $data = $service->data_ga->get( "ga:".$profile_id, $monthbefore, $today, 'ga:sessions', // here rather than session we can use parameter 'ga:visits' to the page visits $optParams ); print_r($data); // here you will get the analytics data for each profile. } Google Analytics page views count Leave a reply Your email address will not be published. Required fields are marker *
close

on 30th June 2015 / by sarika.k
Google Analytics is a service offered by Google that generates detailed statistics about a website's traffic and traffic sources and measures conversions and sales. Sign up for a Google Analytics account and can get your “Tracking ID” under the "Property Setting" section, it should look something like, “UA-xxxxxxxx-x”. Google Analytics module allows you to enter your Google Analytics account number into the modules settings page. It will then automatically add the required Javascript to every page generated by Drupal. Configuration Install Google Analytics module and configure from the path: Home » Administration » Configuration » System Add Google Analytics account number. You can go ahead and save your settings. For most users, Google Analytics module's default setting should get them started. For advanced users, this module offers some advanced features. You can also configure the following features. Domains - This setting lets you select what you are tracking, like single or multiple domains. Pages - This setting lets you select which pages you intend to track. You can provide a list of pages and paths that you want or don’t want to track. Roles - This setting lets you choose what roles we want to track or not track. Users - This is an interesting setting for those sites that have strict privacy policies. This option allows the site users to opt out of tracking depending on the option selected.To make this work, you will have to change permissions under Google Analytics, and allow users to Opt-in or out of tracking. There will be a checkbox in user profile that would allow users to opt-out of tracking. In order to track file types, add in the file extensions (without the dot) separated by pipes "|". Messages - This helps you track the messages shown to the users. Search and Advertising - This lets you track your internal site searches and AdSense advertisements in your Google Analytics. Some additional settings might be required. Privacy - This setting lets you anonymize visitors IP addresses, and also respect do not track policy. Google Analytics Drupal Leave a reply Your email address will not be published. Required fields are marker * Nicolas Colombres (not verified) access_time 19 Jun 2019 - 19:09 This articcle is perfect since we have a client that wants to install GA. Thanks for this Sarika ;) Add new comment
close

on 03rd February 2015 / by thomas.john
While working on a WordPress site one of the requirement was that client should get alerts on document downloads. In-order to achieve this we implemented an event tracking functionality for the site. In this article I will be explaining different methods to track an onlick event using jquery and get the updates in Google Analytics. In your site if you have a multiple files to download, say .doc, .pdf, .txt etc, we could easily track this using a Google Analytics. First step is to create a Google Analytics Account which helps you to generate the ID to track all your site actions. Now download and enable the Google Analytics plugin for your site. In Google analytics settings page 'wp-admin/options-general.php?page=googleanalytics' enter the ID generated in Google Analytics site. You can view the event details in Google Analytics Site path "All Website Data --> Content--> Event--> Overview". Here comes the tracking part. Different ways to implement this is shown below Simple way to do this is by calling an onClick event in corresponding a tag. See the code below <a href="URL/filepath/filename.pdf" onClick="_gaq.push(['_trackEvent', 'PDF', 'PDF_Download', 'Filename']);">Click to Download</a> But its not a good practice. Instead of this we could call this event using a jquery. In case of Wordpress site Create a js file in "wp-content/themes/theme_folder/js/name.js. Now enter the following code. Following code is to track a single pdf file. $(document).ready(function() { $('a[href$="filename.pdf"]').click(function() { _gaq.push(['_trackEvent', 'PDF Downloads', 'PDF_Download', $(this).attr('href')]); }); }); To track all the pdf files together, use the follwoing code $(document).ready(function() { $('a[href$="pdf"]').click(function() { _gaq.push(['_trackEvent', 'PDF Downloads', 'PDF_Download', $(this).attr('href')]); }); }); Now you can call this function in the corresponding page where the file download is available, by inserting follwoing code <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/name.js"></script> In case of Drupal website Create a js file in "sites/all/themes/theme_folder/js/name.js. Now enter the following code. Following code is to track a single pdf file. (function($){ Drupal.behaviors.pdbfileonedownload = function (context) { $('a[href$="Pdffileone.pdf"]').click(function() { _gaq.push(['_trackEvent', 'PDF', 'PDF_Download', $(this).attr('href')]); }); } }(jQuery)); To track all the pdf files, use the follwoing code (function($){ Drupal.behaviors.pdbfiledownload = function (context) { $('a[href$="pdf"]').click(function() { _gaq.push(['_trackEvent', 'PDF', 'PDF_Download', $(this).attr('href')]); }); } }(jQuery)); You can define this js file in corresponding info file as shown below. scripts[] = js/name.js If you want to the js file for particlar pages then you can do this using preprocess_page function. Here using function drupal_add_js we could add the js file. See the code below. function theme_name_preprocess_page(&$vars) { /*By checking URL arguments and calling js*/ if (arg(0) == 'users' || arg(0) == 'user') { drupal_add_js(drupal_get_path('theme', 'theme_name') . '/js/name.js'); $vars['scripts'] = drupal_get_js(); } /*By checking node yupe and calling js*/ if ($vars['node']->type == 'problem') { drupal_add_js(drupal_get_path('theme', 'theme_name') . '/js/name.js'); $vars['scripts'] = drupal_get_js(); } } Hope you came to know how to track an event using jQuery and Google Analytics. If you have any doubts/queries regarding this feel free to comment below. Reference URL : https://developers.Google.com/analytics/devguides/collection/analyticsj… Wordpress Google Analytics Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 11th December 2014 / by reshma.mohan
Universal Analytics is a set of technological innovations that is aimed at improving the way data is collected and processed in Google Analytics.The Universal Analytics Upgrade is a process which is used to upgrade all your classic Google Analytics properties into Universal Analytics properties without losing any data or changing your account settings.All Google Analytics properties will soon be required to use Universal Analytics. Any properties that don’t follow the upgrade process will be auto-transferred to Universal Analytics in the future. The Universal Analytics Upgrade is a two step process. Review this section to get an overview of each step before you begin, so that you get an idea on what to expect throughout the process. Step 1: Transfer Property Transfer your properties to Universal Analytics from the Google Analytics Admin page. You may also customize session and campaign timeout periods. Only users with Edit permissions may initiate the property transfer from the Google Analytics Admin page. The transfer takes minutes to initiate, but you should allow 24 - 48 hours for it to complete. When the transfer is completed, the property is ready to receive data from Universal Analytics tracking code. Move on to Step 2 after the transfer is complete. Step 2: Update Tracking Code (optional) Replace existing tracking code with new Universal Analytics tracking code. The time taken to update your tracking code will vary depending on your current implementation and tracking needs. When this step is completed, you will have access to the full benefits of Universal Analytics, including new reports and features. your full upgrade to Universal Analytics is now complete. Step 1: Transfer a Property to Universal Analytics Transferring a property to Universal Analytics is done in the Google Analytics Admin page and must be initiated by a user with Edit permission. To transfer an existing property to Universal Analytics: Sign in to Google Analytics. From the Admin page, select the account and property you want to upgrade. In the property column, click Universal Analytics Upgrade. In the section called Transfer to Universal Analytics, click Upgrade. Read the information in the pop-up. If you can confirm that you are ready to transfer your property to Universal Analytics, click Upgrade. If you are not ready, click Cancel. (Optional) Click Show timeout settings and configure your session and campaign timeout handling. If you don’t configure these settings, the default values will be used. Learn more about configuring the timeout settings. Allow 24 - 48 hours for the transfer to finish. When a note that says Property transfer complete appears in your account, the transfer to Universal Analytics is done. When the transfer is complete, your data will be handled by the Universal Analytics processing technology. Configure Timeout Settings (optional). Universal Analytics lets you configure settings from your Admin page that were previously managed in your code. You can configure two of these settings during the Universal Analytics Upgrade process: Session timeout and campaign timeout. These settings let you control how long sessions and campaigns can last before they timeout. By default, sessions end after 30 minutes and campaigns end after 6 months. If you don’t customize these settings while your property is transferring, the default values will be used. Step 2: Update your Tracking Code (optional) After your property has been transferred to Universal Analytics, you can start using the new tracking libraries and protocols, like analytics.js. Although this step is optional, you only get the full benefits of Universal Analytics after you implement the new tracking code. As soon as you've created your new property, you’ll be taken to the tracking code that you'll need to install on your own site. Make sure to place it right before your head tag. Every line of Google Analytics code on your site needs to be updated. Google Analytics Leave a reply Your email address will not be published. Required fields are marker *
close

on 03rd November 2013 / by webmaster
It appears that losing access to your google analytics account is not an uncommon problem. One of our clients recently came to us with this problem that they do not know the Google account connected to the google analytics id used in their website. Google analytics does not have a direct interface through which you can request a reset password or send reminder email to the connected email address. However there is a solution to the problem. Google product forum lists 100s of similar requests by Google Analytics users who have lost access to the linked Google account. The suggested approach to the problem is listed clearly here in Account Recovery Process for Google Analytics You will however need an adwords account to take this through. You can initiate contact through the Adwords support system from the following URL Adwords Support Hope this helps. Google Analytics Google Adwords Leave a reply Your email address will not be published. Required fields are marker *
close

on 03rd June 2013 / by varghese.t
If you want know how to configure Google Analytics for your Drupal site checkout How to check Google Analytics on a Drupal website?. We can also get the analytics info from within a Drupal site. Read on to know how to view the Google Analytics report from within a Drupal site. A typical Google Analytics Report contains the following information about your site. It contain graphs of visitor information for the past 30 days. Site Usage statistics like Visits, Pageviews, Pages/Visit, Bounce Rate, Average time on site and the percentage of new visitors. Top Pages: Top Pages allows you to get the info regarding the top pages and the no of visits to that page. Top Referrals: Top Referrals provides you with the info regarding the top referral websites and the no of visit we get from that site. Top searches: Top Keywords likewise provides the keywords that have brought the most amount of traffic to our site. Requirements It requires Google Analytics, Google Analytics Report module and Google chart API, OAuth module v3 or higher and on Drupal 6, OAuth depends on Autoload module v2 or higher. Installation After enabling the Google Analytics and Google analytics report module, visit admin/settings/google-analytics-reportsto authenticate your site with Google. This module uses the OAuth module for authentication. If our domain is verified with Google then configure your Google profile and cache time from the following configuration page /admin/config/system/google-analytics-reports Drupal Google Analytics Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 01st February 2013 / by tiju.thomas
Google Analytics is a service offered by google which is mainly used to analyze the traffic of drupal/non drupal websites. This module gives statistical information such as number of people who viewed a drupal page. average time visitors stayed on a drupal website. average number of pages viewed per visit etc. Thus, to watch over the statistical growth of a website, this module is a must. To ensure the working, the module must be tested after configuring it with the drupal/non-drupal site. Here I have documented on how to test a Google Analytics module configured on a website. Test cases/ Checklists against Google Analytics module Open the pages you want to check Google Analytics Take the source code by pressing Ctrl + u Search Google Analytics by pressing Ctrl + f Enter 'googleanlaytics' in the search form Verify whether the Google Analytics details is displayed in the source code. For example; if Google Analytics is enabled you will see the following code We can test this as both anonymous and logged in user.For admin users, follow the steps below: Login as admin into the site. Click on 'Modules' dispayed in the admin menu bar   Enter 'Modules' page and Search google analytics by pressing Ctrl + f Enter google anlaytics in the search form Verify whether the google analytics module is enabled for the site. If the developers give the credentials of google analytics account, then we can simply check the traffic of our site. For that, Open the site http://www.google.co.in/analytics/ Login to the site by using the credentials of google analytics account Enter the home page and check the traffic of our site From this page the number of Visits, Unique Visitors, Average Visit Duration, Bounce Rate, % of New Visits etc can be viewed. These ways help a user to check Google Analytics on a site. SEO Google Analytics Software Testing Leave a reply Your email address will not be published. Required fields are marker *
close

on 12th November 2012 / by webmaster
Many Drupal users have reported that after they had successfully installed the Google Analytics module on their website, the Google Analytics admin page reported a "Tracking code not detected" error. The status reports page of Google Analytics also indicated a "Tracking Not Installed" error. If you are facing the same situation with the Google Analytics module in your Drupal site then read on. Here is the fix. Many users had resolved it by adding a trailing "/" to their site hostname in the profile page in Google Analytic's settings. For example. "example.com" DID NOT WORK "example.com/" WORKED So check if it has a trailing '/' in the settings page of Google Anaytics. Hope that helps. The easiest way to solve a Drupal issue is to hand it to the Drupal experts. Do you need professional help in building your Drupal site? We can provide a wide range of Drupal services to help you deploy your Drupal site easily and quickly. Get in touch with us to know more. Reference: http://drupal.org/node/518640 Drupal Google Analytics Drupal Issues Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 13th December 2011 / by sujith.s
Google Analytics is an invaluable tool if you are a web developer, blogger or if you simply own a website. Few other tools come close to the volume of information  offered by Google Analytics. Besides it is also free of charge which certainly adds to its popularity. However utilizing this huge amount of data offered by Google Analytics is a challenge and if done carefully, the data can be converted into intelligence that alerts you to possibilites of increasing the effectiveness of your website and makes sure that it reaches out t the right audience.  In this tutorial, we are going to show you how to make the best use of Google analytics from a web developers perspective. What is Google Analytics? Google, in its attempt to help you make the best out of your website, offers you state-of-the-art monitoring and analytics services for your websites, free of cost, under the banner Google Analytics. Google Analytics - What is it for? Why do you need it? To increase the traffic to your website, you should first know what makes people come to your website, how they come to you, and what you can do to improve it. Further, you need to know how these visitors interact with your site, and what you can do to make them stay longer and keep coming back. A clear knowledge of such basic factors helps you make intelligent decisions regarding your site’s business. What does Google Analytics’ offerings look like? Here’s a quick screenshot of what the basic Google Analytics Dashboard offers you: Google Analytics by default provides you valuable insights on number of visits number of pageviews bounce rate visitor demographics traffic sources How GoogleAnalytics works The following block diagram represents the process flow that takes place: Google Analytics requires you to add a small piece of Javascript code (called the Google Analytics Tracking Code) to your site’s pages. The data collection process begins when a visitor’s web browser requests a page from the webserver. The server responds by sending the requested page back to the browser. When the visitor’s browser starts to execure the Tracking Code present in the webpage source, the script identifies various attributes regarding the visitor and the browsing environment, such as time spent on the site, where the user is from (location), etc. While the data is being collected, the browser actively and asynchronously downloads a script by the name ga.js from the geo-loadbalanced servers of Google. Once the ga.js script has been fully downloaded and starts executing, the collected data is sent to Google’s servers. The server stores the received data into a temporary log file. These log files are processed at regular intervals (of approximately 3 hours), and the processed data is available as reports in 24 hours. Advanced Google Analytics Features - Event Tracking and Custom Variables The event tracking feature of Google Analytics allows you to track events (also called “actions” or “conversions”) on your website. An action occurs when a visitor clicks on something, perhaps a PDF white paper download. The event tracking code is a basic line of JavaScript that you add to a hyperlink. The tracking code should look something like this: _trackEvent(category, action, opt_label, opt_value, opt_noninteraction)Parameters: category (required) : The name you supply for the group of objects you want to track. action (required) : A string that is uniquely paired with each category, and commonly used to define the type of user interaction for the web object. label (optional) : An optional string to provide additional dimensions to the event data. value (optional) : An integer that you can use to provide numerical data about the user event. non-interaction (optional) : A boolean that when set to true, indicates that the event hit will not be used in bounce-rate calculation. Eg: Play Custom Reports in Google Analytics using Custom Variables Google Analytics allows custom data monitoring and reporting by allowing you to play with Custom Variables. This allows us to monitor custom data such as tracking popular authors on your site, which does not otherwise come under the default set of reports in Google Analytics. Each custom variable basically has a name-value pair. The full declaration structure may have: Name Value Slot or index - to organize our custom variables, ranging 1 through 5 Scope - 3 levels - page, visitor, visit Google Analytics primarily deals with three levels of scope: Page Level - persists as long as the visitor is viewing a particular page. Visitor Level - persists on the visitor’s browser as a cookie, for 24 months or till the cookie gets deleted. Visit Level - persists for an entire visit session. Scope and Index work in tandem to decide how many custom variables you have available at any given time. How to implement a new Google Analytics Custom Variable The first step is to write a line of _gaq.push command for the same. The next step is to place this in your page source according to your tracking requirement. The standard asynchronous javascript code snippet for implementing custom variables in Google Analytics is of the following syntax: _gaq.push(‘_setCustomVar’, index, ‘name’, ‘value’, scope); where index is a number from 1 through 5, scope is a number from 1 through 3, {1=>visitor, 2=>visit, 3=>page}, name, value are just plain text._gaq.push makes sure that all what you enter in this command gets pulled into Google Analytics. Now that you have this part done, where do you place this code? The following example cases would illustrate this good: You may want to categorize all of the pages on your site using a page level custom variable. In this case you might place the custom var code in the standard GA code snippet, like this: //<![CDATA[ var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXXX-1']); _gaq.push(['_setCustomVar',1,'PageCategory','Sports', 3]); _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); })(); // ]]> Or, if you’re going to identify someone as a ‘member’ of your site, you might place the code on a page after the visitor logs in. Like this: //<![CDATA[ var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXXX-1']); _gaq.push(['_setCustomVar',1,'VisitorType','Member', 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); })(); // ]]> These should give you a pretty good headstart on making the best out of Google Analytics. Web Development SEO Google Analytics Leave a reply Your email address will not be published. Required fields are marker * Anonymous (not verified) access_time 19 Jun 2019 - 18:21 The Contents of this site are really very good. I hope We will get this type of contents and information from this blog in future days too. You certainly have some agreeable opinions and views. Your blog provides a fresh look at the subject. Add new comment