Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Well, not exactly banners, I just used this word as it is easier to understand in a title.

So, I have 16 different CTA "boxes" with a couple lines of persuasive copy and a CTA button. I want to test which one performs the best. I am showing the boxes randomly and counting button clicks as events in GA. However, without knowing how many times each CTA "ad" has shown, number of button clicks doesn't say much.

So, with Google Analytics, how do I trigger an even every time such CTA box is shown? It's basically a DIV that I'm in need of placing some javascript to.

share|improve this question

I guess you will have to use Event Tracking to identify the loading of the different types of CTAs you have.

That, with perhaps the CTA box clicked configured as goals will do it.

share|improve this answer
up vote 0 down vote accepted

This would be the correct answer to the question. To count impressions, we just need to place a 0 size image with onload parameter:

<img width=0 height=0 src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" onload="_gaq.push(['_trackEvent', 'Banner', 'Impression', 'BANNERNAME',2.00,true]);"/>

But the flaw of this method is that if the banner is on bottom of the page, the impression is still being counted, even if user didn't scroll down the page and didn't see the banner.

It would be nice if somebody could advice on how to count the impression event in analytics only when users saw the banner for sure?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.