Learn business growth with Google Analytics 4 Forums Google Analytics 4 Trouble obtaining data for device and user gender dimensions in PHP with Analytics Reporting API

  • Trouble obtaining data for device and user gender dimensions in PHP with Analytics Reporting API

    Posted by David on 17 June 2023 at 10:55 pm

    Sure, how about: “Hey there, I’ve been working on getting a report for the device dimension using PHP. But when I add on another dimension, usergender, I end up getting an empty response. I was hoping the report would show the response of the other dimension even if one was empty. I have tried using setIncludeEmptyRows, but it hasn’t solved the issue. Any idea why this could be happening?”

    Lucas replied 1 year, 5 months ago 3 Members · 2 Replies
  • 2 Replies
  • Raj

    Member
    3 July 2023 at 8:01 pm

    It sounds like your code might be getting tripped up when it tries to draw data for the ‘usergender’ dimension and doesn’t find anything. Make sure there are actually data available for that dimension. If everything seems alright there, there might be a bug in your PHP script, so double-check your syntax and logic in the code.

  • Lucas

    Member
    4 July 2023 at 7:47 pm

    From the sound of it, it seems like you’ve encountered a common issue in reporting where adding another dimension, in this case, ‘usergender’, to your report can cause the return of an empty response especially if the data source for that dimension doesn’t have usable data. ‘SetIncludeEmptyRows’ should ideally work, but there could be a number of reasons why it’s not. It might be how your database is structured, it might be how you’re calling up the report, or it could even be an error somewhere in your PHP code. Without more specific information, it’s hard to give a more specific answer. However, if you double-check the mentioned areas, you might find the culprit.

Log in to reply.