Single Page Application Tracking with Analytics: no virtual pageviews in dashboard - google-analytics

I'm trying to use some virtual pageviews on my single page application (Angular)
I set the js code as follows:
ga('set', 'page', pageviewurl);
ga('send', 'pageview');
where the var pageviewurl could be something like:
'/form/w/toyota?from=hp#step=2__from=js'
But I'm not able to see anything related these virtual pageviews on Analytics dashboard...
am I doing something wrong?
Or in which section of the dashboard can I get pageview data?
Thanks

I answer to my question just to confirm that the js code is correct.
After some time, by accessing to Analytics dashboard, virtual pageview data is visible in the section Real time -> content

Related

Google Analytics: Set content group when sending virtual pageview

Is it possible to set a content group for a virtual pageview?
As a user moves through the stages in my one page checkout I use virtual pageviews to track their progress in Google Analytics, like so:
// Moves to address section
ga('send', 'pageview', '/checkout/address');
// Moves to payment section
ga('send', 'pageview', '/checkout/payment');
Throughout the site I use content grouping to group similar pages together, using the tracking code method e.g.
// Product pages
ga('set', 'contentGroup1', 'Product ');
// Category pages
ga('set', 'contentGroup1', 'Category');
I want to do the same for the checkout so I can report on all of these pageviews together if required.
Is there a way to set the content group for a virtual pageview using tracking code?
You should be able to set the CG for your VPVs in the same way that you set it for your normal page views. Just remember that when you use the set method, it will apply to all hits until it is changed or until you load another page.

Google Analytics - send data to google analytics

I have recently been given a project requirement to send data over to google analytics from a certain page. I have no clue how to do that.
Account Id and every thing has already been created, I just want to know how I could send data on load of a certain webpage.
I have been looking up google analytics from what I understood I think I need to first push into ga functions the analytics tacking id and I think I need to have pageview as the event.
Could someone please share tutorial links for this?
Regards,
Farhan
I hope you are looking for the Event Tracking with the Google Analytics as page Tracking is Quite Simple you just need to add the tracking code and page Tracking is done so check out the below link and code you will find how you can do the Event Tracking
Send custom Event to Google Analytics
ga('send', {
hitType: 'event',
eventCategory: 'Videos',
eventAction: 'play',
eventLabel: 'Fall Campaign'
});

Google Analytics page view tracking

I am using a shiny dashboard with about 20 pages and recently implemented Google Analytics to track page views. The number of pageviews in GA seems to be the same for all pages. I think that once the home page is hit, all other pages are getting hit as well.
I need help to solve this problem. My GA.js script contains the auto script generated while creating an account with GA and this script.
ga('send', 'pageview', {'title': 'Shiny Dashboard','page': '/#shiny-tab-dashboard'});
I have generated similar lines for all the pages with different 'title' and 'page'. Thanks for helping out.
Google analytics does not record hash parameters by default so you would have to a
change your tracking code
https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#allowAnchor
Below are the changes required
Replace
ga('create', 'UA-XXXXX-Y', 'auto');
with
ga('create', 'UA-XXXX-Y', {'cookieDomain':'auto','allowAnchor': false});

Can I pass google analytics marketing tracking code to a following page (when the landing page doesn't have GA code)

I am in a scenario where we are tagging up on part of the site (purchase.mysite.com) with GA tags but we aren't tagging up the main site (www.mysite.com).
The problem is that a lot of traffic that goes to purchase.mysite.com initially goes via www.mysite.com which means if a user lands on www.mysite.com with a marketing tracking code and then goes to purchase.mysite.com the tracking code will be lost and all traffic from this route will be considered referral.
Is there a way to still pass this marketing campaign code when the user hits purchase.mysite.com (other than adding GA code to the main site which we don't want to do)?
If not possible in GA, is there another technical solution like saving the tracking code in the cookie and then setting it when the user goes to purchase.mysite.com?
Any help would be greatly appreciated.
Thanks,
Frank
Frank,
Your final paragraph htis the nail on the head: save your campaign tracking data into your own cookie and then read this cookie when you're on a page with GA on it and manually set the campaign data. You only need to set it once and it will then propogate through for the whole session/user as per your requirements.
To set the campaign data manually, just use code such as this (ref: https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#campaignName)
ga('set', 'campaignName', 'My Campaign Name');
ga('set', 'campaignSource', 'anotherwebsite.com');
ga('set', 'campaignMedium', 'cpc');
ga('send', 'pageview');
notes
You must set at least Source & Medium for the data to register with GA
Medium has a fixed set of possible values as per this google doc: https://support.google.com/analytics/answer/1033173?hl=en

I am trying to set value for custom dimension in google analytics for my website

I'm new to google analytics and i don't realize how make it works.
We have a website and we want to capture the customerId as custom variable in google analytics in order to analyze the behavior of each user with the site.
For this, i start to use google analytics (analytics.js) a few days ago and i created a custom dimension (to know who user access).
The dimension was created with session scope because those values must be sent once per session.
After that, i add the code needed as is explained here:
ga('create', 'UA-#######-1', 'domain.com');
ga('send', 'pageview', { 'dimension1': '<%Convert.ToString(Session["SelectedCustomerID"]);%>' });
I've tried this code and others configurations but google analytics doesn't take the values.
What i'm doing bad? Please suggest me a way to capture the information.

Resources