xsquareduk
Technical User
Hi all,
I have a template for a website which is called on multiple pages. Each of these has hovering buttons on to say whether someone likes the page or dislikes it, which at the moment just pops up a JavaScript alert for testing.
I want to change this so that when someone clicks 'I like this' it sends to Google Analytics both the event that they LIKED the page, but also the URL of the page they liked. Obviously as this is called in a template, it can't just send the same thing for each page. In effect, I am asking how to craft the string in JavaScript to pass the URL to Google Analytics.
Everything I have seen for tracking downloads, etc makes you specify a path to track, like /downloads/file.pdf for example. I would be happy to track something in the manner of /likes/url and /dislikes/url if necessary.
Hope someone can help, thanks!
I have a template for a website which is called on multiple pages. Each of these has hovering buttons on to say whether someone likes the page or dislikes it, which at the moment just pops up a JavaScript alert for testing.
I want to change this so that when someone clicks 'I like this' it sends to Google Analytics both the event that they LIKED the page, but also the URL of the page they liked. Obviously as this is called in a template, it can't just send the same thing for each page. In effect, I am asking how to craft the string in JavaScript to pass the URL to Google Analytics.
Everything I have seen for tracking downloads, etc makes you specify a path to track, like /downloads/file.pdf for example. I would be happy to track something in the manner of /likes/url and /dislikes/url if necessary.
Hope someone can help, thanks!