Google analytics integration

Created on 23 June 2009, over 15 years ago
Updated 19 September 2024, 3 months ago

In order to get better statistics and make use of new "event tracking" of Google Analytics, i have tweaked the ad_image module.

I think that this idea could be developed and improved so any ad can be tracked.

My solution.
change line 19 of ad_image.module to

$ad_image = "<div class=\"image-advertisement\" id=\"ad-$ad->aid\"><a href=\"$ad->redirect/@HOSTID___\" title=\"". check_plain($ad->tooltip) ."\"". ad_link_attributes() ." onClick=\"javascript: pageTracker._trackEvent('Drupal Ads','Click','".$ad->url."');\"><img src=\"$image_path\" width=\"$ad->width\" height=\"$ad->height\" alt=\"". check_plain($ad->tooltip) ."\" /></a></div>";  }

the new code

onClick=\"javascript: pageTracker._trackEvent('Drupal Ads','Click','".$ad->url."');

will track any click on image ads to google analytics. You'll see it in "Content / Event Tracking" as a new event type ("drupal ads"), aside of "outgoing links" and "mail"

any feedback will be aprecciated

Imad.
www.seresromanticos.com
www.estuequipo.com

Feature request
Status

Closed: outdated

Version

2.0

Component

ad_image module

Created by

🇪🇸Spain imad

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany lrwebks Porta Westfalica

    Drupal 6 is EOL and no longer supported. Closing this as outdated for that reason. Thanks for your contribution!

Production build 0.71.5 2024