Title: empty namespaceKey
Last modified: August 24, 2016

---

# empty namespaceKey

 *  ResolvedPlugin Author [thomtels](https://wordpress.org/support/users/totels/)
 * (@totels)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/empty-namespacekey/)
 * 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://wordpress.org/plugins/google-analytics-post-pageviews/](https://wordpress.org/plugins/google-analytics-post-pageviews/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [thomtels](https://wordpress.org/support/users/totels/)
 * (@totels)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/empty-namespacekey/#post-6055786)
 * Fixed in latest patch. Thanks! 😀
 *  Plugin Author [maximevalette](https://wordpress.org/support/users/maximevalette/)
 * (@maximevalette)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/empty-namespacekey/#post-6055800)
 * You’re welcome!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘empty namespaceKey’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/google-analytics-post-pageviews.svg)
 * [Google Analytics Post Pageviews](https://wordpress.org/plugins/google-analytics-post-pageviews/)
 * [Support Threads](https://wordpress.org/support/plugin/google-analytics-post-pageviews/)
 * [Active Topics](https://wordpress.org/support/plugin/google-analytics-post-pageviews/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-analytics-post-pageviews/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-analytics-post-pageviews/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [maximevalette](https://wordpress.org/support/users/maximevalette/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/empty-namespacekey/#post-6055800)
 * Status: resolved