Analytics
4.7K members online now
4.7K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

How to set the Page value when sending an event to GA ?

Follower ✭ ☆ ☆
# 1
Follower ✭ ☆ ☆

I have a Single Page App and sending virtual pageviews through the GA API.

 

When sending an event, GA is showing the page value in the GA dashboard of the url that was shown in the browser when sending the event. However, that is not the page I want it to send. How can I set the page myself ? Can I use the "document path" value for it? Or differently?

Thanks,

- Ed

Re: How to set the Page value when sending an event to GA ?

Participant ✭ ✭ ☆
# 2
Participant ✭ ✭ ☆
Hi,

if you want to send event with different page path setting you have to add some extra parameters to hit:
ga("send", "event", "category", "action", "label", {page: "/my-virtual-page"});

Another way is to set it by using "set" command:
ga("set","page","/my-virtual-page");
then you can send pageview or event hits and page path will be set to "/my-virtual-page" until you change it again using "set" command.