Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The conditional on line 53 of googleanalytics.js using the Non-identity / strict inequality (!==) operator is invalid as the Drupal.settings.googleanalytics.trackDomainMode variable is stored as a string, while the test is against an integer. This is causing outbound link events to be fired for top level domains, which is not desired. I see two options, use the less restrictive equals or not-equals operators, or cast it to an integer at the top of the script. I'd lean towards the former.
Comments
Comment #2
felixodie CreditAttribution: felixodie commentedSubscribing. I'd like to see this issue solved.
My Analytics shows 300,000 outbound clicks but the correct number of clicks are 15.000 which is kind of annoying.
Can provide more information if anyone interested to know more.
Comment #3
hass CreditAttribution: hass commentedIn
$link_settings['trackDomainMode'] = (int) $track_domain_mode;
it is converted to integer. The test$this->assertRaw('"trackDomainMode":2,', '[testGoogleAnalyticsTrackingCode]: Domain mode value is of type integer.');
verifies this, too.Can you check your Drupal settings if the JS code shows the 2 in doubles quotes or not, please?
Comment #4
hass CreditAttribution: hass commentedAh, this was fixed after 2.3 was released. Use dev for now, please.