# MemberSpace

### Installation

To integrate Referral Rocket with MemberSpace, you'll need to add two scripts to your website:

1. First, add the main Referral Rocket script to the `<head>` section of your website:

```html
<script 
  type="text/javascript" 
  campaign-id="YOUR-CAMPAIGN-ID" 
  defer 
  src="https://app.referralrocket.io/widget/widgetIndex.js">
</script>
```

2. Then, add the following script to the page where members sign up:

```html
<script>
const handleMemberSignup = ({ detail }) => {
  const { memberInfo } = detail;
  
  // Get campaign instance
  const campaign = window.Rocket.getCampaign();
  
  // Add the new member as a participant
  campaign.addParticipant({
    email: memberInfo.email
  })
  .catch(error => {
    console.error('Error processing referral:', error);
  });
}

// Listen for MemberSpace signup events
document.addEventListener('MemberSpace.member.info', handleMemberSignup);
</script>
```

### How It Works

1. When a new member signs up through MemberSpace, it triggers the `MemberSpace.member.info` event
2. The event handler captures the new member's email address
3. The member is automatically added as a participant in your Referral Rocket campaign
4. The system checks for any stored referral information in cookies
5. If a referral is detected, it's automatically associated with the new member

### Testing

* Verify the integration by completing a test signup through MemberSpace
* You can confirm proper installation by checking `window.Rocket` in your browser console
* Note that referral tracking will only work when your campaign is in live mode

### Important Notes

* Remember to replace `YOUR-CAMPAIGN-ID` with your actual Referral Rocket campaign ID
* Publish your site after adding these scripts
* The integration automatically handles referral detection through stored cookies

### Troubleshooting

If you're not seeing referrals being tracked:

1. Verify both scripts are properly installed
2. Check the browser console for any error messages
3. Ensure your campaign is in live mode
4. Confirm the `MemberSpace.member.info` event is firing on signup

For additional support, contact our team at <support@referralrocket.io>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://referral-rocket.gitbook.io/docs/integrations/memberspace.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
