Melissa Boyle
Melissa Boyle

Reputation: 75

Google analytics tracking an event (external link)

Can anyone help me out with an issue I am having please?

Basically I have set up google analytics for a client site and all is working well. However I have tried to apply an event to an external link to track the traffic clicking on this. The event does not appear within the analytics account and when opening the webpage I am getting a pop up with the following code: Access denied. Please try relaunching In-Page Analytics from the report.[Error: 20006].

I should also mention that I have used the code within the a php include, not sure if this would effect it or not?

Below shows the code I have used on the external link, in addition to the tracking code for the site.

<a href="www.linkhere.com" onClick=”_gaq.push(['_trackEvent', 'resource', 'outbound link', 'www.link.com', 1, true]);” target=”_blank”>Shop online</a>

Many Thanks, Melissa

Upvotes: 1

Views: 636

Answers (1)

Nick Blexrud
Nick Blexrud

Reputation: 9603

The issue is with the first double-quote after the onClick; it's an closing double-quote, and thus you're not getting any event tracking show.

<a href="www.linkhere.com" onClick="_gaq.push(['_trackEvent', 'resource', 'outbound link', 'www.link.com', 1, true]);" target="_blank">Shop online</a>

You have:

<a href="www.linkhere.com" onClick=”_gaq.push(['_trackEvent', 'resource', 'outbound link', 'www.link.com', 1, true]);” target=”_blank”>Shop online</a>

The other double-quote for the target="_blank" also has a closing double-quote.

Upvotes: 2

Related Questions