• ResolvedPlugin Author thomtels

    (@totels)


    In the latest update a unique identifier was added to invalidate old cache results, but is missing the key on the initial call.

    google-analytics-post-pageviews/google-analytics-post-pageviews.php:466

    $namespaceKey = get_transient('gapp-namespace-key');
    
    if ($namespaceKey === false) {
      set_transient('gapp-namespace-key', uniqid(), 86400 * 365);
    }
    
    $gaTransName .= '-' . $namespaceKey;

    If $namespaceKey is empty and returns false on, then the gaTransName will not correctly be set with the $namespaceKey as it is never updated.

    suggested edit:

    if ($namespaceKey === false) {
      $namespaceKey = uniqid();
      set_transient('gapp-namespace-key', $namespaceKey, YEAR_IN_SECONDS);
    }

    sidenote: There’s a time constant for the transients api you can use instead of the numerics for seconds in a year YEAR_IN_SECONDS. Maybe a little more clear about what you’re doing, but not necessary.

    https://www.ads-software.com/plugins/google-analytics-post-pageviews/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘empty namespaceKey’ is closed to new replies.