Expand my Community achievements bar.

SOLVED

3rd party pixel rule firing in launch but not seen in network call.

Avatar

Level 6

Quantcast pixel rule firing in the launch but not seen in network call. This code used to work when the website worked on page load but doesn't work in direct call rule.

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

 

Based on your code snippet, there are a few potential reasons why the Quantcast pixel might not be firing.

  1. Vendor Permission: The first condition checks whether "Quantcast" is an allowed vendor. If this condition is not met, the code inside the if statement won't run. Make sure that "Quantcast" is indeed an allowed vendor.

  2. Page Conditions: Your code has conditions for the page not being an "Order Confirmation Page" and the path not being "/store/signup/complete". If either of these conditions is true, the pixel will not fire. Make sure you're testing on a page that satisfies these conditions.

  3. User ID Variable: Your code tries to capture a User ID. If this value is not available at the time the rule fires, it may affect the functionality of the Quantcast pixel.

  4. Quantcast Library: The if-else block relies on the window._qevents object. If the Quantcast library hasn't loaded by the time this rule fires, the pixel won't fire. This could be especially relevant if you switched from a page load rule to a direct call rule. The direct call rule might be firing before the Quantcast library has loaded.

As a first step, you could try adding more detailed logging to your rule to help identify which condition might be causing the issue. For example:

 

if(_satellite.marketingPermissions.isVendorAllowed ("Quantcast") === true){
    _satellite.logger.info("Quantcast is an allowed vendor");
    
    if(_satellite.getVar("CMS Page Name") !== "Order Confirmation Page" && location.pathname !== "/store/signup/complete"){
        _satellite.logger.info("Page conditions met");
        
        var userID = _satellite.getVar("User ID");
        _satellite.logger.info("User ID is: " + userID);
        
        if(window._qevents)
            window._qevents.push({qacct:"xxxxxxxxx",uid:userID});
        else
            _satellite.logger.info("Quantcast library hasn't loaded");
    } else {
        _satellite.logger.info("Page conditions not met");
    }
} else {
    _satellite.logger.info("Quantcast is not an allowed vendor");
}

 

 This should give you more detailed information in your console log about which condition is not being met.

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

 

Based on your code snippet, there are a few potential reasons why the Quantcast pixel might not be firing.

  1. Vendor Permission: The first condition checks whether "Quantcast" is an allowed vendor. If this condition is not met, the code inside the if statement won't run. Make sure that "Quantcast" is indeed an allowed vendor.

  2. Page Conditions: Your code has conditions for the page not being an "Order Confirmation Page" and the path not being "/store/signup/complete". If either of these conditions is true, the pixel will not fire. Make sure you're testing on a page that satisfies these conditions.

  3. User ID Variable: Your code tries to capture a User ID. If this value is not available at the time the rule fires, it may affect the functionality of the Quantcast pixel.

  4. Quantcast Library: The if-else block relies on the window._qevents object. If the Quantcast library hasn't loaded by the time this rule fires, the pixel won't fire. This could be especially relevant if you switched from a page load rule to a direct call rule. The direct call rule might be firing before the Quantcast library has loaded.

As a first step, you could try adding more detailed logging to your rule to help identify which condition might be causing the issue. For example:

 

if(_satellite.marketingPermissions.isVendorAllowed ("Quantcast") === true){
    _satellite.logger.info("Quantcast is an allowed vendor");
    
    if(_satellite.getVar("CMS Page Name") !== "Order Confirmation Page" && location.pathname !== "/store/signup/complete"){
        _satellite.logger.info("Page conditions met");
        
        var userID = _satellite.getVar("User ID");
        _satellite.logger.info("User ID is: " + userID);
        
        if(window._qevents)
            window._qevents.push({qacct:"xxxxxxxxx",uid:userID});
        else
            _satellite.logger.info("Quantcast library hasn't loaded");
    } else {
        _satellite.logger.info("Page conditions not met");
    }
} else {
    _satellite.logger.info("Quantcast is not an allowed vendor");
}

 

 This should give you more detailed information in your console log about which condition is not being met.

Avatar

Level 6

It says its allowed to run but I dont see call in network. But when I reload the page network is seen.  It is a single page application.

Avatar

Community Advisor

Single Page Applications (SPAs) present a different set of challenges compared to traditional web applications, especially when it comes to triggering tracking pixels or making network calls. SPAs don't fully reload the page when users navigate, so conventional page load-based tracking may not work as expected.

Your issue seems to be related to this. Your Quantcast code seems to be designed to fire on a page load event, but in a SPA, the page load event only happens once, when the application first loads. This could explain why you see the network call on reload but not during normal navigation.


To handle this, you need to set up a way to fire your Quantcast code based on the events that SPAs use for navigation. This could be a URL change, a click event, or a custom event that you define.


Here's an approach to implement this:

  1. Identify the event: First, identify what event signifies a "page view" in your SPA. This could be a route change event if you're using a router, or some other event if you're not.

  2. Bind to the event: Once you have identified the event, you need to bind your tracking code to it. This means that your Quantcast code will run every time the event is triggered.

  3. Test: Finally, thoroughly test your setup to ensure that your tracking code fires as expected during SPA navigation.

You may need to consult with your developers or with Quantcast's support team to tailor this solution to your specific SPA framework and use case. The key is to tie your tracking code to the appropriate navigation events in your application.

Avatar

Community Advisor and Adobe Champion

It sounds like you are using DOM Ready or Window Loaded to trigger your tracking.. that won't work for SPAs... 

 

You either need to use:

  • "History Change" (which isn't completely reliable - and requires that your URL is correctly uploaded)
  • Have your developers trigger a custom JS event that you create a custom code listener for (Adobe does have a event listener... it doesn't work well... do it in custom code)
  • If you are using an event based data layer, like the Adobe Client Data Layer (adobeDataLayer), you can have your developers push an event to the data layer, then use the Data Layer extension to listen for that event

This will also need to be used for your Adobe Page Views... if your page views are working, check what the trigger is for those, as it will need to be similar....