I am trying to track a goal in Google Analytics through a virtual pageview. As you can see in the code example, it is linking out from a picture instead of text with a link.

enter image description here

I triple-checked to see if I had my Goals set up properly in the Admin panel, where the goal URL is set to "/click2", the goal type is URL destination and the match type is Head Match.

enter image description here

I am unsure if the problem lies in the fact that it's linking out to an "https" link or if the link is attached to a picture that serves as a Call To Action. I would appreciate if any of you can help shed some light on this problem I'm having.

  • Did you get this working?
    – Anagio
    Jul 25, 2012 at 16:26

3 Answers 3


Have you used the GA debugger? https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna?hl=en

Is the link going to a different domain? If so that could be the issue, I use events for tracking external links, and that works just fine. IMO it is a cleaner fit to use events for tracking external links rather than virtual pageviews.

If the link is not going to a different domain, why do you need a virtual pageview at all? Just use the url of the target page?


Do you have _gaq.push(['_trackPageview']); in your snippet just below your profile ID?

such as

gaq.push(['_setAccount', 'UA-XXXXX-X']);

It doesn't matter that you're linking from an image, i've used onclick Event tracking on input boxes. Are you tracking virtual page views anyplace else on your site? If so do they go to HTTP or HTTPS? Have you tested changing the href to http and not https?

  • Hi Anagio, yes I do have the _gaq.push snippet in my profile ID. The purpose of the goal is to see how many people are clicking "sign up" and being pushed to an entirely different (https) website to complete the transaction. As for testing it anywhere, no I haven't yet. Would having https matter in terms of tracking the goal?
    – Will
    Jul 25, 2012 at 23:57
  • No it shouldn't but if you're tracking the clicks does event tracking work?
    – Anagio
    Jul 26, 2012 at 0:06

I would recommend checking within Google Analytics content section for the pageviews: this can be found in the menu under Content > site content > all pages; this will rule out an error in how the goal has been set up (however, the goal does look to be set up correctly)

Alternatively you could look to implement this piece of code:


Although it would record more than what you want it would measure all external link clicks and that you wouldn't need to set up future on-click events to measure external clicks



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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