Pico Window Object

Pico Window Object properties and listener code

Pico Window Objects require prior knowledge

⚠️ NOTE: This is an advanced Pico feature that requires familiarity with JavaScript to fully utilize. We recommend working with a developer if you are unsure how to proceed.

When the plugin is first loaded, it will fire a pico.init event. This signifies that the plugin has successfully loaded and is ready to work. After initialization is complete, the plugin will fire a pico.loaded event to indicate the user's information has been fully loaded. The global window Pico object now has a user object that is available to access.  

Here's a breakdown of the Pico object properties:

  • email: Email address of the user if available - defaults to null
  • first_name: First name of the user if available, defaults to null
  • last_name: Last name of the user if available, defaults to null
  • membership_type: Type of recurring payment if available, available options ["subscription", "single-donation", "recurring-donation", null], defaults to null
  • tier: Name of the tier they have purchases, If no name was provided defaults to null
  • group_name: Name of the group they are associated to, defaults to null
  • total_paid: Lifetime total of all purchases, defaults to null
  • recurring_payment: Current recurring payment amount, defaults to null

This is typically how you would listen to an event fired at the window:

window.addEventListener('pico.loaded', function() {<br style="box-sizing:inherit;">&amp;nbsp; &amp;nbsp; console.log(window.Pico.user)<br style="box-sizing:inherit;">})