- Drupal 7 Google Analytics Tutorial
- Drupal 7 Add Google Analytics Code
- Drupal 7 Google Analytics
- Drupal 7 Google Analytics Download
- Google Analytics Download Data
Browse other questions tagged google-analytics or ask your own question. The Overflow Blog Level Up: Creative Coding with p5.js – part 7. Google Analytics Drupal 7 Tutorial The Outright Novice's Guide to Google Analytics. SEO Analytics SEO Tools The author's views are totally his or her own (excluding the unlikely occasion of hypnosis) and might not always reflect the views of Moz. Apr 18, 2012 Drupal 7.x: From version 7.24 onwards, ctools is added as a new dependency. Another example of how it can be used with Google Analytics is provided by dagomar in.
The value of Google Analytics is a no brainer. Everyone knows the importance of tracking user trends on their website and understands the power behind the insights Google can help provide.
Finally, the module does not address Google Analytics tracking. Committing To Full Compliance. To address the additional steps not covered within the EU Cookie Compliance module, Forum One has created a Drupal 7 module that overrides the default configuration and disables Google Analytics tracking for users who have chosen to opt out.
More and more of our customers are also starting to see the advantages that Google Tag Manager can provide as well, and want to start using it on their existing websites without waiting for a complete site rebuild. Within Continuous Development Agreements, we have been helping many organizations navigate the transition from Google Analytics to Google Tag Manager. Here’s an overview of why you might want to do this, and how you can accomplish it in a timely and effective manner.
What Google Tag Manager Offers
Before we talk about what Google Tag Manager does, it’s important to distinguish it from Google Analytics. It’s not an upgrade or an improvement; the two are fundamentally different. If you add Google Tag Manager to your site, it doesn’t mean that Google Analytics goes away.
Just like the name suggests, Tag Manager is a tool that allows website administrators more control over the snippets, integrations, tracking tools, and other scripts that run on their website when users come to visit. Tag Manager offers no analytics, insights, or tracking on its own. So you’ll still go to the same Analytics dashboard for user statistics if you’ve decided to add Google Tag Manager to your site - which is good! It means website owners don’t need to relearn a system to get the same information.
So, what’s all the fuss about Tag Manager for then, if Analytics stays the same? Tag Manager does offer some tools that allow website managers to track some even more granular information about user behavior. For instance:
- Analytics may be able to tell you where users come from before they hit a particular page, and
- Tag Manager can help track the effectiveness of a specific button on a particular page to get users to convert to a desired action.
As you can see, Tag Manager is very useful if you have multiple calls to action across the site. Even within a single page, Tag Manager can help you figure out which buttons, blocks, and calls to action are the most effective.
Possibly even more helpful though, is Tag Manager’s ability to add multiple tracking scripts to a page of the website, or globally across the website. In the past, additional JavaScript tags needed to be added into a website’s codebase one by one with help from a development team. Depending on how many other priority items managers had stacked up for sprints, it could take several weeks to get these simple tags out to the production site.
With Tag Manager, site owners have the ability to add integrations with other services onto their website without any custom code from the development team. They can add these scripts within the Tag Manager console and publish them independently all in a single day if needed. Some practical examples include:
- Cookie acceptance banners provided by third party sites (very useful when GDPR compliance deadlines were looming)
- Chat applications that overlay the site and provide
- Social media integration, such as LinkedIn tracking
- Marketing automation tools that help track potential leads
We’ve seen this lead to a great separation of responsibilities, where our development teams can focus on what they do best - maintaining the Content Management System - while empowering website owners to own the integration points between the website and their partnerships with other services that do what they do best. It means customers are getting the most out of their contracts with us, and not adding unnecessary overhead on the products they choose to augment the website.
How To Set Up Google Tag Manager On Your Website
There is a short and long explanation of how to do this, and we’ll give you both. The basic information you need goes like this:
- Create a Google Tag Manager Account and Container
- Install the module for your Drupal 7 or 8 website: https://www.drupal.org/project/google_tag
- Add your Google Analytics ID into Google Tag Manager
- Configure the Google Tag Manager Module on your website
- Disable the Google Analytics Module (tracking may not work right otherwise)
We always recommend that you add any modules to the codebase with help from a development team that can make sure your code is all properly version controlled.
With that disclaimer, if you are manually managing your own site completely through the Drupal Admin User Interface it’s possible to add the new module in manually and disable the old one manually as well. If this is the case for you, we hope that the following information will help you see great results quickly, and that you’ll contact us when you’re ready to get a development team involved in maintaining your site.
Getting Started With Google Tag Manager (The long version!)
Step one is the same: you’ll need a Google Account of course. You can visit their splash page at https://marketingplatform.google.com/about/tag-manager/ if you’d like to, or go straight to https://tagmanager.google.com to get started. Once you are there and logged in, you’re looking for the “Create Account” button up near the top of the screen.
Each account can have multiple “containers.” A specific container connects with a specific website.
For instance, you may choose to create one container for your live website and another container for your non-production sites so that you can use sandbox accounts on development and staging environments. Each container will have a unique ID formatted like GTM-XXXXXXX.
Install The Module
As noted above, if you absolutely must you can do this manually, though it is far better (and safer) to have a Drupal development agency add the module to your codebase and enable it on the live site. Depending on how quickly you want to get this done, you can make a brief stop in a non-production environment to try all of these steps and make sure tracking is working correctly before activating everything on the live site.
Configure Google Tag Manager to Trigger Google Analytics
There are a few ways to do this, and part of understanding them will be learning the Google Tag Manager interface itself. You’ll definitely want to have your Analytics tracking code handy, formatted like UA-#######-#. If you get stuck, the Google Support system is extensive. Articles like https://support.google.com/tagmanager/answer/6106716?hl=en can help guide those learning their way around.
Again, this is a good place to use different analytics accounts for non-production sites if you so choose.
Configure the Google Tag Manager module in Drupal
Get your container ID ready (GTM-XXXXXXX) and log into your website. Going to /config/system/google_tag will get you to the configuration page in both Drupal 7 and Drupal 8, or you can find it the long way by navigating your list of modules or the configuration page. The configuration screen is pretty simple, but does provide some handy options if you want to exclude Tag Manager from running in particular circumstances. This looks similar for both versions of Drupal as well:
Drupal 7
Drupal 8
Don’t forget to hit save when you’re done.
Disable Google Analytics Module And Other Cleanup
If you don’t disable the Google Analytics module on your website, the GA tracking ID may be duplicated in your code, which can lead to incorrect analytics information (maybe double, or may fail to track sometimes). That’s reason enough on its own, but we’d be remiss not to take this opportunity to remind website owners that it’s always best to disable and uninstall modules that are no longer in use. Keep those codebases lean!
It’s also worth mentioning that just like with Google Analytics, if you plan to start using Google Tag Manager to manage all of your integrations, you’ll need to remove any scripts that have already been hard-coded into the site before you add them to Google Tag Manager and start having them run that way. We’ve seen cases where trying to load a script via Tag Manager and directly through the website code at the same time will prevent the integration/tracking from running at all.
Is It Worth It?
All those setup steps may sound like more work than it’s worth at first, but this is definitely one of those things that sounds scarier than it really is. Typically, our customers are able to use a few hours from their ongoing improvement contracts with us to prioritize the module installation as a small part of a normal two-week sprint, and then follow up with removing the old module code from their site in the sprint that follows.
When it comes to the time investment required for your team, there is a bit of a learning curve with Google Tag Manager, but generally within the first month of making the change, website owners become comfortable with the new system and start impressing their stakeholders and direct reports with all of the ways they can use it to enhance the site. Once the setup is complete you’ll look back and wonder why it ever seemed complex, and enjoy how managing integrations on your site has become a breeze.
Are you looking for help with analytics, tracking, and site performance improvements? Contact our team to learn how we can help you advance your marketing goals.
Fill out the form to learn how FFW can support your needs.
Read next:
Open-source software: A CMO’s competitive advantage
'Should I wait for Drupal 9 to upgrade my Drupal 7 site?'
Ray Saltini and Leigh Anderson to share expertise on project management for Drupal, customer experience and writing case studies.
Drupal 7 Google Analytics Tutorial
A Drupal Developer, Designer and Trainer Walk into a Webinar..
Drupal 7 Add Google Analytics Code
Download DevDungeon.com's Drupal 7 module with all the files and sample code needed to get started! Check it out here.
Event tracking with Google Analytics has pretty much become a standard on all new sites. Google provides ample documentation on using the analytics, but the tricky part is getting it to integrate the way you want with Drupal. The Drupal Google Analytics module offers basic functionality out of the box. It can track page hits, specific user roles, offsite links, and download clicks. It also supports custom variables using tokens.
The Google Tag Manager is another amazing tool. You can set it up to trigger unique events based on various URLs in your site. This is useful for triggering events like 'Contact Form Loaded,' or 'Form submitted successfully.' However, it can't handle things like onClick events.
Triggering an event on a mouse click is easily implemented using JavaScript in a .js file. This method can be used to track user interactions like clicks, focus, and hovers that aren't handled by the Google Analytics Drupal module or the Google Tag Manager.
There are still occasions though, when none of the above methods are good enough. For example, you shouldn't track a form submit event on a submit click, because they might have filled it out incorrectly and the form will not actually be saved. The user will end up correcting the form and clicking submit again. That would cause two submission events to track when only one should count. If the form action goes directly to the same page, then the Tag Manager can't use the URL because it wouldn't know the difference between a form start and a form submission. The only way to get a reliable event is by hooking in to Drupal. If we trigger an event based off hook_comment_insert(), then the event will only trigger on a successful save and will not send a false positive if the validation failed. The catch with Drupal is that you can't output JavaScript code at that point in the Drupal process. Echoing raw JS or calling drupal_add_js() will not work in most hooks.
Drupal 7 Google Analytics
I have developed a Drupal module to provide a way to trigger Google track event calls using any Drupal hook. It stores all JavaScript files related to event tracking in the modules js folder. This means the theme layer remains clean and all the analytics events are in one easy to manage place. The code is actually quite simple, so I am just going to provide it here.
Drupal 7 Google Analytics Download
The JavaScript file that is loaded globally for all pages will generally have functions attached to onClick events. The JavaScript files that are loaded on specific hooks, like user register and comment insert, will have functions that call a trackevent as soon as the page is loaded instead of waiting for a click.
Examples of famous sketches by Da Vinci include: - Sketch of a Flying Machine (Helical Air Screw, 1493), an early version of a modern helicopter which Da Vinci did not actually build or test. Design for a Flying Machine (1488). Stretching Device for a Barrel Spring (c. Designs for a Boat (c. Famous Celebrities Famous People Pencil Sketches Portrait Art Drawings Art Background Headshot Photography Portrait of Musician Joe Leeway Cartoon Faces Cartoon Drawings Cartoon Art Art Drawings. “Daniel in the Lions' Den” ( 1614-16) is a very iconic painting of Rubens, and there is a publicly known early sketch of these lions. The sketch is slightly more developed than just a preliminary drawing as we can note some study of light and texture. This lion sketch may actually be more famous. All the best Famous Sketches 37+ collected on this page. Feel free to explore, study and enjoy paintings with PaintingValley.com. Famous people sketches. Oct 15, 2019 - Explore Elsie Mangones's board 'Art / Drawings - Sketches by Famous Artists', followed by 733 people on Pinterest. See more ideas about drawings, art, sketches.
Google Analytics Download Data
The code should ideally be updated so the session carries an array of 'triggered_hooks', and in page preprocess, we could use one for loop to load a js file based on the name of the index. This way we wouldn't have to had an isset() check for each new hook we added.