Development

Image Click Tracking with Google Analytics Events

joe.price's picture

I recently wrote a short article about Tracking Form Submissions with Google Analytics Events that focused on one particular use case of event tracking. A client of mine wanted to begin tracking image clicks on their site and I thought I'd share what we did.

The question was, how many times is a particular linked image clicked? Google Analytics automatically tracks the page views on each end of the link, but it doesn't show if they got they there by clicking on a slideshow graphic or other promotional image you might be displaying.

Tags: 

Tracking Form Submissions with Google Analytics Events

joe.price's picture

Google Analytics can be customized to track just about anything on your site.

Google Analytics Event Tracking is a method available in the ga.js tracking code that you can use to record user interaction with website elements, such as a Flash-driven menu system.

With ga.js, you would commonly apply Event Tracking to:

Tags: 

Responsive Google AdSense Ads

joe.price's picture

In Drupal, the AdSense module provides a way to easily implement Google AdSense Managed Ads on your site. The problem is, the ad size is fixed in the module generated blocks. For a responsive site, this can be a real problem -- a 728x90 Leaderboard ad isn't going to display properly on a 320px smartphone. After testing a few other alternatives, a really flexible solution is a custom block.

In essence, the code checks at page load to see:

Tags: 

Display Suite, Custom code field & PHP

joe.price's picture

Recently, I needed to customize the standard 'Read more' link that Display Suite provides, based on the taxonomy term of the nodes. There are a few ways to do this but a Custom code field turned out to be a simple and effective solution.

In the following code, I output the term name as a class for the Read more link. If you need any entity info, use Display Suite Code (this allows the use of $entity - php code does not).

Tags: 

Subscribe to RSS - Development