Privacy protection feature in Firefox is preventing data from being pushed to Google Tag Manager's Datalayer

Recently, I discovered that the conversion tracking in Google Analytics for a website we developed and maintain has been inaccurate by 20% - 40% daily.

After testing in various browsers except Firefox, conversions are reflected in Analytics immediately without any issues.

However, when using Firefox with Enhanced Privacy Protection enabled (default setting), an error occurs:

Cross-Origin Request Blocked: The Same Origin Policy restricts access to the remote resource at . (Reason: CORS request did not succeed).

Disabling Enhanced Privacy Protection resolves the issue.

The code snippet used to push to datalayer is:

<script type="text/javascript">
  document.addEventListener( 'wpcf7mailsent', function( event ) {
   window.dataLayer.push({
      "event" : "cf7submission",
      "eventAction": "FormSubmission",
      "eventCategory": "Contact Form Submission",
      "eventCallback" : function() {
        // Callback to redirect page is never executed in Firefox.
        window.location.href = "https://www.domain.co.uk/thank-you/"; 
        return false;
      },
      "eventTimeout" : 2000 
    });    
  }, false );
</script>

The listener checks for email submission on the site, pushes data to Data Layer for tracking, and redirects to a thank you page upon completion.

This does not seem like a CORS related issue as other browsers execute the code flawlessly.

Firefox's explanation of the error can be found here.

TLDR: Firefox is blocking datalayer push due to Enhanced Privacy being toggled on, contradicting standard conversion tracking scripts. How do I bypass this block?

UPDATE

A reference from Mozilla https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Privacy/Tracking_Protection states:

How does Firefox choose what to block?

Content is blocked based on the domain it originates from.

When tracking protection is active, sites engaged in cross-site tracking are blocked.

Sites mostly affected are third-party advertising and analytics sites.

Is Firefox indeed obstructing Google Analytics for standard conversion tracking now?

Answer №1

It appears that my original assumptions were correct to some extent. While Firefox no longer blocks all analytics access by default, it does block anything ad-related that attempts to send conversion or tracking code related to ads.

If you are trying to trigger a goal after completing an ad-related activity, it will be blocked, but other tracking scripts will still be executed.

Firefox has decided to block all third-party tracking scripts by default to enhance user privacy.

Fascinating Observations

Google heavily relies on this tracking and conversion data, hence Chrome lags behind in implementing measures to block ad-related traffic. With over 60% market share (https://en.wikipedia.org/wiki/Usage_share_of_web_browsers), your tracking should remain unaffected for now.

However, Safari and Firefox, not depending on ad revenue, have enforced strict tracking restrictions.

Safari & Firefox

Firefox blocks all tracking scripts from third-party sources, particularly those from advertisers embedding scripts on your site.

On the other hand, Safari goes further by automatically deleting all tracking cookies after 7 days of site inactivity. This may skew your data as returning visitors could appear as new ones.

Conclusion

It seems like traditional conversion and ad tracking for website owners is facing challenges with these browser changes. Changes are likely imminent as these updates take effect.

As of now, there doesn't seem to be a workaround. I attempted using a proxy to bypass tracking embeds, but without knowledge of Google's tracking methods, spoofing submissions to analytics proved impossible.

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

Guide to creating a Map with typescript

I've noticed that many people are converting data to arrays using methods that don't seem possible for me. I'm working with React and TypeScript and I have a simple map that I want to render as a list of buttons. Here is my current progres ...

Is there a way to manually stop a file upload (stream) using a XMLHttpRequest on the server?

Utilizing XMLHttpRequest (Level 2) to transfer a file to a node.js server, I am currently examining the file-stream for valid headers on the server side. The goal now is to halt the upload if any errors are encountered during streaming. My XMLHttpRequest c ...

What is the method for specifying the HTML file extension within Visual Studio?

I am having issues with my project recognizing the CSS and other files in the HTML files I have created, even though I have double-checked the extension paths. How can I resolve this problem? https://i.stack.imgur.com/85ooE.png https://i.stack.imgur.com/F ...

What are some ways to prevent manual page reloading in Node.js when using EJS?

Currently, I am utilizing Node as a server and frontend in EJS. My project involves working with socket.io, which is why it is essential that the page does not refresh manually. If a user attempts to reload the current page, the socket connection will be d ...

Create a custom VueJS component by utilizing an npm package

Looking to navigate around X-frame restrictions? You can check out this npm package: https://www.npmjs.com/package/x-frame-bypass To make it work, include the following tag within your HTML: <iframe is="x-frame-bypass" src="https://example.org/">& ...

"An error occurs when attempting to clear Rad Grid data with javascript: htmlfile: Invalid argument thrown

Hello, I am currently developing an ASP.NET application. I am facing an issue where I need to clear the data in a Rad grid upon button click using JavaScript. The code snippet that I have attempted for this is as follows: document.getElementById(&a ...

How can you write a parameterless function in Ramda using a point-free style?

Take a look at this functioning code snippet: var randNum = x => () => Math.floor(x*Math.random()); var random10 = randNum(10) times(random10, 10) // => [6, 3, 7, 0, 9, 1, 7, 2, 6, 0] The function randNum creates a random number generator that wi ...

The dependency graph of npm modules shows significant differences

I've been exploring the capabilities of the npm-remote-ls package to analyze dependency trees for modules. This tool is installed globally on my system. When I execute Command 1: npm-remote-ls object-assign The tree structure displayed is as follows ...

Proper functionality of Chrome Extension chrome.downloads.download

I am currently developing an extension with a feature that allows users to download a file. This file is generated using data retrieved from the localStorage in Chrome. Within my panel.html file, the code looks like this: <!DOCTYPE html> <html&g ...

Enhance user experience with AngularJS Bootstrap autocomplete feature by automatically filling input box when hovering over dropdown options

I am currently implementing the AngularJs Bootstrap typeahead functionality. Typically, when we enter text that matches an option, the dropdown list appears. https://i.stack.imgur.com/395Ec.png What I aim for is to automatically fill the textbox with the ...

Utilize an external JavaScript file function within an AngularJS controller

I have an external JavaScript file with additional functions that I am trying to call from an Angular controller. Here is an example of the external.js file: ... ... function fun() { ... ... } ... ... The controller in question is called acccountCon ...

Encountering a problem with scrolling the modal to the top

I am currently working on a code snippet that involves scrolling the modal to the top position. The purpose of this is to display form validation messages within the modal popup. Below are the jQuery code snippets that I have attempted: //Click event t ...

Creating a dynamic object with JavaScript using two arrays

Can anyone assist me in constructing an array of objects by combining data from two different arrays? const parent =[ { Id: 1, Cate: 'Accommodation', p_id: null }, { Id: 4, Cate: 'National Travel', p_id: null } ] const child =[ { ...

A Greasemonkey script for organizing and categorizing webpage elements

I've been working on a script to enhance the functionality of Facebook's find friends page by organizing suggested friends based on mutual connections. If you're interested in checking out the code, you can find it right here: http://pasteb ...

Creating a JSON array in JavaScript for future reference

I am interested in creating a JSON array where I can define the fields and add data to it later in my code. However, I am unsure about the correct syntax to achieve this. So far, my attempts have resulted in some parse errors; <script> var myJSONAr ...

Ensuring JS consistently monitors changes in value

Is there an equivalent of (void update) in Unity that is called every frame in Web Development (using JavaScript)? "I want it to continuously check if certain values have changed and then update them accordingly." let governmentprice = parseFloat(select ...

Tips for Dynamically Binding Data in Angular ChartsWant to learn how to dynamically bind

I have integrated angular-charts directives into my application and everything works perfectly when initializing the data. However, I encountered an issue when reading the data from a JSON file and assigning it to the chart. The x-axis and y-axis are gener ...

Is there a way to eliminate a div and all its contents from the DOM?

As I work on my web application, I am trying to implement a system where error messages can be returned via ajax upon success or failure. The ajax script is functioning correctly in terms of returning errors or successes. However, my challenge lies in com ...

Is it possible to add a vertical scrollbar to the vertical navigation pills on a Bootstrap

Is it possible to create a vertical scroll bar for my nav pills when they exceed the screen size? /* * * ========================================== * CUSTOM UTIL CLASSES * ========================================== */ .nav-pills-custom .nav-link { c ...

Tips for showing solely the current page number within angular pagination

HTML : <!-- pagination controls --> <div class="pagination-container"> <pagination-controls (pageChange)="onPageChange($event)" [maxSize]="1" [id]="config.id" [directionLinks]="true">< ...