Analytics
2.8K members online now
2.8K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
 
Guide Me
star_border
Reply

Event Tracking in Google Analytics from Squarespace website

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello,
I am trying to track the event of "Playing" a video and track it as a goal in Google Analytics. I have used this two codes:
1. <p hidden>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXX-X']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src=('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
</p>

and 2.  In the video page:

_trackEvent("Video", "Play", Youtube link)

I have pasted the 1st code in the home page and the second on my video block. But the goal is not able to record the event in Goggle Analytics.

Please help me understand what I am doing wrong? Should I just use the second code only. IN the second code I pass the category, action etc, to be in sycn with GA.

1 Expert replyverified_user

Re: Event Tracking in Google Analytics from Squarespace website

[ Edited ]
Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭

The second code is
onclick="_gaq.push(['_trackEvent','Videos','Play','https://youtu.be/aaaa"]);"</p>

Re: Event Tracking in Google Analytics from Squarespace website

A T
Participant ✭ ✭ ✭
# 3
A T
Participant ✭ ✭ ✭

You can easily debug on the website with GA debugger:
https://chrome.google.com/webstore/detail/jnkmfdileelhofjcijamephohjechhna

You can check in chrome, console tab with 'Preserve log' turned ON.

Re: Event Tracking in Google Analytics from Squarespace website

[ Edited ]
Top Contributor
# 4
Top Contributor

Hi @A T

Can you please elaborate on how you can use GA debugger for debugging? Perhaps some suggestions on what to look for, and even possible solutions. I think this would be more beneficial than just pointing the OP to a link to figure things out on their own.

Thanks for your help!

Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn

Re: Event Tracking in Google Analytics from Squarespace website

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Thanks for your response!

I am having no coding background and the debugger is more confusing to me!

I would greatly appreciate if you could help me get this work and record events.

Do I only need the second code?

Thanks.