Expand my Community achievements bar.

SOLVED

Cypress and Adobe Analytics Failure

Avatar

Level 1

I am using Cypress automation, at the moment I am testing/writing tests for Analytics. With Google Analytics I was easily able to write my tests using cy.intercept() function and was successfully able to assert Google Analytics. But... with Adobe Analtics the cy.intercept() function doesn't see Adobe Analytics. I been researching solutions with no luck, 1. there is very little info 2. their solutions suggest to use cy.interept(). Here is what I have so far: 

The prior steps are to login the website and turn on Adobe Analytics. Then I am supposed to assert that Adobe Analytics are up and running. I am using this: 

 

 

 

            cy.intercept('POST', 'your_website', { statusCode: 200 }).as('adobe-analytics')

            cy.wait(5000)
            cy.log('**Step 6**')
            cy.waitForStableDOM({timeout: 55000})
            cy.wait(5000)
            cy.wait('@adobe-analytics').get('@adobe-analytics')
            .then((xhr) =>{
                console.log("Adobe-Analytics Response:", xhr)
                
            })

 

 

Where it fails is at cy.wait('@adobe-analytics') and the response I get that the 1sst request to the route: @adobe-analytics no request ever occurred. 
Any help is appreciated. 
1 Accepted Solution

Avatar

Correct answer by
Level 1

THANK YOU!!! . What it was was the long website name I added in the cy.intercept() 

example: 

So, I followed what you did and got rid of 'POST' and changed the intercept to: 
'/b/ss/**' and it worked. 
It looks like this now: 
cy.intercept('/b/ss/**',).as('adobe-analytics') = Boom! It works!
Now, I'm able to pull any info off of it! 
Thank you so much!!!
 

View solution in original post

4 Replies

Avatar

Community Advisor

This worked for me:

 

describe('detect Adobe Analytics request', () => {
  it('visits a webpage', () => {
    // specify the intercept first
    cy.intercept(
      '/b/ss/**',
    ).as('adobeAnalyticsRequest');

    // then load the web page to be tested
    cy.visit('https://www.website.com');

    // then check for the AA request
    cy.get('@adobeAnalyticsRequest').then((req) => {
      console.log('adobeAnalyticsRequest', req);
    });
  });
});

Strangely, if I call cy.visit() before cy.intercept(), then the AA request does not get intercepted. But this also happens with other network requests, so it's not an AA-specific issue.

 

Avatar

Correct answer by
Level 1

THANK YOU!!! . What it was was the long website name I added in the cy.intercept() 

example: 

So, I followed what you did and got rid of 'POST' and changed the intercept to: 
'/b/ss/**' and it worked. 
It looks like this now: 
cy.intercept('/b/ss/**',).as('adobe-analytics') = Boom! It works!
Now, I'm able to pull any info off of it! 
Thank you so much!!!
 

Avatar

Community Advisor

You're welcome!

But actually, I want to thank you too for "introducing" Cypress to me (although an introduction wasn't your post's intention). I had been looking for an automation tool that works like Selenium but better, and now thanks to your post, I've found it! 

Avatar

Level 1

Cost savings, integration with other Google services, user-friendly interfaces, and powerful data visualizations are often factors in the switch from Adobe Analytics to Google Analytics 360. For many companies is, Google Analytics 360 is more affordable and easily available than the Adobe platform Like Birla Advaya as an alternative. Its smooth integration with other Google products like , and Google Ads simplify data management and reporting to further encourage the conversion.