The screen view count remains consistently at zero when using both Google analytics and Single Page Application analytics

Recently, I integrated GA into my most recent project. The web section of the project was built using the angularjs1 framework.

I've encountered a peculiar issue. I successfully implemented GA on Android, iOS, and web. However, there seems to be an anomaly with the screen views count for the web platform which always displays zero. Despite this, I can observe a total count of 553 and unique screen views at 214. Screen tracking is achieved by setting virtual page views.

https://developers.google.com/analytics/devguides/collection/analyticsjs/single-page-applications

Below are snippets of my code:

In my index.html file:

<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
</script>

In my app.js run.inject section:

$window.ga('create', 'UA-my-tracker-id', 'auto');

In my controller:

$window.ga('set', 'page', 'home-web');
$window.ga('send','pageview');

Attached is a screenshot of my GA statistics for reference:

https://i.stack.imgur.com/MyAML.jpg

Answer №1

I wanted to share an answer to my own question because I discovered a solution that could be helpful to others facing similar issues.

The problem stemmed from the fact that when I created my tracker account two years ago, I mistakenly set the "What would you like to track?" field to mobile app.

To resolve this, I created another tracker with the correct type for my website. Now everything is working smoothly - I have one tracker for my mobile app and one for my web app. Additionally, I learned that Google recommends using Firebase Analytics for mobile apps:

https://support.google.com/analytics/answer/2587087?hl=en

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Encountering an issue with npm installation in the angular-phonecat tutorial: Module 'update-notifier' not found

Having trouble running npm install in the angular-phonecat directory. Could be a problem with my paths, but I'm not certain. Any help would be greatly appreciated. Keep running into Error: Cannot find module 'update-notifier'. If I try to in ...

Encountered an issue while attempting to load the required module

I'm having trouble setting up Stripe for my app and getting errors when trying to implement the module. Typically, I would require the module at the top of the file in order to use it, but when I do this in the paymentCtrl file, it doesn't work a ...

Decode PDF417 barcode images with ease using HTML and JavaScript on both desktop and mobile web browsers

Looking to utilize JavaScript to decode PDF417 type barcode images? If you're encountering Zxing plugin issues in mobile browsers but it works well on desktop browsers with https://github.com/PeculiarVentures/js-zxing-pdf417, consider alternative sol ...

Distinguishing Between Angular and Ajax When Making Requests to a NodeJS Server

Trying to establish communication between an Angular client and a NodeJS server. Previous method using JQuery $.ajax({ url: "/list", type: "POST", contentType: "application/json", dataType: "json", success: function(data) { console.log("Data ...

`Save user edits on the webpage using Electron`

I am encountering an issue with my electron app. I use the window.loadUrl() method to navigate between pages. Some of these pages require users to input data that needs to be saved. The problem arises when a user enters information, moves to another page ...

When using Lockdown.js with NPM, I encounter a blank file being returned

When using Lockdown.js for NPM, I encountered an issue where the command to generate the lockdown file resulted in an empty file. Here are the links for the dependencies: NPM lockdown git Here is a snippet from my package.json: { "name": "nw", "pri ...

Using autocompletion in AngularJS by integrating with Mongoose to retrieve data

Hello everyone , I'm currently exploring the Autocomplete feature in AngularJS that retrieves data from mongoose. I came across an example like this one on Stack Overflow: https://stackoverflow.com/questions/18460374/angularjs-autocomplete-from-http ...

Passing Headers from NodeJS to Angular

Running a single-page Angular web app with a Node server, requests to the server are received from a reverse proxy that includes authentication headers. The Angular app occasionally sends requests to another server that require the same authentication he ...

UI-Router is malfunctioning, causing ui-sref to fail in generating the URL

I'm currently working on a project that involves Angular, Express, and UI-router for managing routes. While I've properly configured my $states and included the necessary Angular and UI-router libraries in my HTML file, I am facing an issue wher ...

What is the best approach for transmitting file and form data from an AngularJS application to a Node.js server?

Salutations! I am in the process of developing a MEAN application with a video upload form. However, I have encountered an issue while making a POST request in AngularJS to my API - the data is not reaching my controller. Can anyone point out where I might ...

The issue with Protractor's sendkeys function is that it requires an X display for converting keycodes

I've encountered an issue while attempting to execute Protractor e2e tests in a Vagrant VM using headless Chrome. Despite successfully configuring Xvfb, I face an error when trying to fill out a form: unknown error: an X display is required for keycod ...

Error message encountered in MEAN application request

Learning how to use the MEAN stack has been an exciting journey for me as I venture into building web apps. Rather than relying on yeoman generators or npm app to do the heavy lifting of generating code, I have delved into creating my entire app from scrat ...

NodeJs causing issues with reloading AngularJs routes

I was able to successfully create a sample app by following a few examples, but I've encountered an issue that I'm struggling to resolve. In my Angular app, the routes work fine like this: - http://localhost:8888/#/login works However, when I re ...

Creating blank entities with app.post using AngularJS and mongoose in a node.js environment

My issue seems to be with my REST API as it is posting empty objects. The value I am retrieving from req.body.name appears correctly when I log it using console.log(req.body.name);. POST: { name: 'typing any name', status: null } typing any na ...

Utilizing Angular routing in HTML5 mode within a Node.js environment

While I've come across other solutions to this problem, they all seem to have drawbacks. One option leads to a redirect, which could be disastrous for my front-end application that relies on Mixpanel. A double-load of Mixpanel results in a Maximum Ca ...

Dealing with a Nodejs/Express and Angular project - Handling the 404 error

Recently, I decided to dive into learning the MEAN stack and thought it would be a great idea to test my skills by building an application. My goal was simple: display a static variable ('hello') using Angular in the HTML. However, I ran into an ...

Ways to store a filestream coming from Node.js into AngularJS

When using my express server, I have a post-request set up to retrieve a pdf file from Amazon S3 and then send it back to Angular. This is the endpoint in my express server: var fileStream = s3.getObject(options).createReadStream(); fileStream.pipe(res); ...

`Node.JS app having issue displaying AngularJS code on Localhost`

I have successfully created a Node.JS application, where I implemented my own HTTP server within the main JS file. The HTML and CSS render correctly on localhost, and even JQuery works when imported via CDN. However, I am facing an issue with displaying ba ...

Error encountered in updating Express + Angular route: PUT operation not allowed

I'm attempting to update a schema using a form, but I keep encountering the following error on both app.put and app.post methods: PUT https://myapp-demo.herokuapp.com/api/events/5523da4d97c5000300f6e713 404 (Not Found) and an ajax callback error Er ...

What is the method to access the controller value within a metadata tag?

One of the challenges I am facing is how to access a variable from a controller and use it in a metadata tag using AngularJS. Below is my approach: First, let's define the variable in the controller: app.controller('homeCtlr', function($sc ...