difficulties in configuring google analytics analytics.js to trigger events upon page load

I need assistance with setting up an analytics event that triggers on page load. I am currently using window.onload if there is no other JavaScript on the page, or $(document).ready() if jQuery is loaded.

The analytics is loading correctly and working fine with analytics.js (not ga.js). To send events back to analytics, I use the following command:

ga('send', 'event',    {'hitType': 'event',
                        'page': '/checkout/', 
                        'eventCategory': 'Forms',
                        'eventAction': 'formload',  
                        'eventLabel': 'Loaded checkout form correctly'});

However, upon checking the analytics dashboard, it shows that only 2 visits sent events, while all other event stats are at 0. It seems like nothing is being logged.

If anyone could offer some guidance on this issue, it would be greatly appreciated. Thanks!

Answer №1

It seems like your code is functioning properly for me. When you mention the dashboard, are you talking about the live one? If everything is displaying correctly there, with the dimensions you've inputted, then all should be well.

I suggest waiting a few days, as GA Universal processing can be a bit sluggish.

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

Showing the total quantity of products, reminiscent of a virtual shopping basket

I am trying to show a number similar to how a shopping cart displays items. The php code I was given currently shows a cookie value, which is mostly functional. However, if you encounter errors while adding items to the cart, it increases the cookie count ...

Changing Pages in MVC Using JavaScript Language

Whenever I select a city on the map displayed on my homepage, a pop-up window opens up with relevant information. The issue arises when I try to navigate to the detail page of the project by clicking on the body of this pop-up window. Unfortunately, I have ...

Validating the value of a Material UI TextField

I am currently working with a TextField that has some validation requirements: minValue = 1 maxValue = 10 These validations are effective when using the arrows in the TextField, however, if I directly type into it, I am able to enter any number. How can ...

Tips for implementing a 2-second delay in Ajax success function

I am experiencing fast responses when fetching data in each loop, but I need to introduce a delay. I have tried using setTimeout and delay methods without success. I believe there might be a different approach that I should consider, but I am unsure how ...

General procedure: identifying the specific input element triggering the keypress event, without directly specifying the ID or other identifiers

I am currently working on a Jquery script that handles validation, and I need help selecting the element on which the keypress event is triggered without explicitly passing the ID #elementid as shown in the code snippet below: var element = **choose the ob ...

Sorting and selecting isotopes, with the option to filter or unfilter

All day I've been struggling to find a solution for my isotope filtering issue. I'm using classes from the database to tag items, such as categories and dates, and allowing users to filter them. The tricky part is making these filters work like o ...

Creating a JavaScript alert in Selenium Java WebDriver with a concise message

While running a Selenium Java program, I am attempting to create a JavaScript alert window with a specific string message. I came across a method that involves executing JavaScript within Selenium by interacting with hidden elements: WebDriver driver; Java ...

Upload file via AJAX immediately after downloading it (no need for storage)

Currently, I am in the process of developing a JavaScript script to safeguard an old game development sandbox website from being discarded by its owners. In order to prevent the loss of all the games on the site, I have managed to create a script that allo ...

Is there a way to determine the remaining time between the present moment and a specific time in JavaScript?

Here's a snapshot of the snippetI have this great idea for a prayer app that can calculate the time remaining between the current time and the scheduled prayer times. My initial approach was to directly find the difference using the following code: ...

Retrieve the text input from the text field and display it as

Is there a way to display what users enter in a textfield when their accounts are not "Activated"? Here's an example: if(active == NULL);{ //I've attempted the following methods. //In this scenario, 'username' is the name of ...

The continual appearance of "No file found" persists when utilizing the $redirectRoute

My goal is to make one of the links on my website lead to another page within the site. Below is one of the two links found on my index.html page: <html ng-app="myApp"> . . . <body> <h1>My Home Page</h1> ...

Leveraging the power of AWS API Gateway and Lambda for seamless image upload and download operations with Amazon

I have successfully created a lambda function to handle image uploads and downloads to s3. However, I am encountering difficulties with the proxy integration from the API Gateway. Despite reviewing the documentation and looking at this specific question ...

JavaScript's power lies in its ability to create dynamic regular expressions

Currently, I am working on code that requires matching a specific number of digits after a decimal point. Here is what I have so far: var input = getValueFromUser(); var count = getCount(); var x = Number(input.toString().match(/^\d+(?:\.\d ...

Tips for running two elixir tasks consecutively?

Check out this piece of code: var gulp = require('gulp'), fs = require('fs'); gulp.task('taskOne', function() { return gulp.src('folder1/file1.js') .pipe(gulp.dest('folder2')); }); gulp.t ...

If the prompt displays 'Monday', then you can output the following days in the console: 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', and 'Sunday'

Could someone assist me with modifying my code so that the entered day is displayed at the end of all days in the console? Currently, it shows up at the top. Here is what I have tried: JavaScript const daysOfWeek = ["monday", "tuesday" ...

Using yargs to pass parameters/arguments to a Node script through an npm script

Is it feasible to retrieve a key from yargs when utilizing as an npm script argument? A user inputs in the OSX terminal: npm run scaffold --name=blah which triggers in package.json: "scaffold" : "node ./scaffold/index.js -- " This leads to const yar ...

Deactivating Node.js files in vsCode for client-side JavaScript files

I'm facing a major challenge when it comes to coding with JavaScript. I have a JavaScript file that is using Node.js, which means I am unable to manipulate the DOM elements. Take this code snippet for example: var form = document.getElementsByClassNa ...

Having trouble accessing env variables from React Component in Next.js?

I recently set up a Next.js project and included an .env file to store environment variables used in my server.js file. However, I am facing an issue when trying to access these variables from a component. Can anyone provide guidance on how to resolve this ...

Adjust the size of the textarea to accommodate the number of lines of text

<script type="text/javascript"> function AutoGrowTextArea(textField) { if (textField.clientHeight < textField.scrollHeight) { textField.style.height = textField.scrollHeight + "px"; if (textField.clientHeight ...

The content entered into the text area does not appear as it was originally typed

Users have reported an issue with the input area - when they update the text, it does not display as expected. For instance, new lines are not being shown. Here is a snapshot of what the user typed in: https://i.sstatic.net/JK0OQ.png However, after upda ...