Title: Plugin Dev: Any rules for declaring variables on window?
Last modified: March 7, 2021

---

# Plugin Dev: Any rules for declaring variables on window?

 *  [hedgerh](https://wordpress.org/support/users/hedgerh/)
 * (@hedgerh)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/plugin-dev-any-rules-for-declaring-variables-on-window/)
 * I’m building a plugin that I hope to have published in the plugin directory. 
   I’d like to use Segment to consensually track some usage analytics in my plugin’s
   admin page.
 * Segment’s Javascript library sets something on the `window.analytics` global.
   Is this okay? Would I want to just make sure I only enqueue it on my admin page?
   Is there something special I should do? One concern was possible variable name
   collisions.
 * I’m having trouble Googling. Getting mostly stuff about Segment/analytics plugins,
   rather than plugin dev.
 * Thank you!
    -  This topic was modified 5 years, 1 month ago by [hedgerh](https://wordpress.org/support/users/hedgerh/).

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

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/plugin-dev-any-rules-for-declaring-variables-on-window/#post-14146753)
 * Review the plugin guidelines, in particular number 7
    [https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/](https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/)
 * If you still desire further clarification, contact the plugin review team directly.
   For contact methods, see the “Communication” item in the gray header on their“
   Make” page. [https://make.wordpress.org/plugins/](https://make.wordpress.org/plugins/)
 *  Thread Starter [hedgerh](https://wordpress.org/support/users/hedgerh/)
 * (@hedgerh)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/plugin-dev-any-rules-for-declaring-variables-on-window/#post-14146999)
 * Thank you. It’d be great to reach out to them.
 * Regarding guideline #7, my understanding was that tracking is allowed if the 
   user consents to it, right?
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/plugin-dev-any-rules-for-declaring-variables-on-window/#post-14151160)
 * That’s my understanding, but I’m not part of the review team 🙂 That’s opt in
   consent, opt out schemes are considered evil 😉

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

The topic ‘Plugin Dev: Any rules for declaring variables on window?’ is closed to
new replies.

## Tags

 * [development](https://wordpress.org/support/topic-tag/development/)
 * [segment](https://wordpress.org/support/topic-tag/segment/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/plugin-dev-any-rules-for-declaring-variables-on-window/#post-14151160)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
