Problem/Motivation

drupalSettings.google_analytics.account should return the account id in javascript, but returns an empty object.

The reason is, that the GaAccount object has to be casted to string explictly! $account property in the object in protected and JavaScript casting can't access it thereby.

Steps to reproduce

Call drupalSettings.google_analytics.account in Browser console on a page and see the value of "account" is ALWAYS an empty object

Proposed resolution

See MR

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Grevil created an issue. See original summary.

anybody’s picture

Priority: Major » Normal
Status: Active » Reviewed & tested by the community

I can confirm this problem, this is quite surely a bug in the new implementation. RTBC+1! Fix works great.

anybody’s picture

Any chance for a review and commit @maintainer? This is blocking #2917905: Add JS-function / method to set ga-disable-...

japerry made their first commit to this issue’s fork.

  • japerry committed 50ecac7 on 4.x authored by Grevil
    Issue #3245331 by Grevil: Account ID inaccessible in JavaScript
    
japerry’s picture

Status: Reviewed & tested by the community » Fixed

Easy enough. Fixed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.