Saas - Get Started
SaaS - Troubleshooting
Partners / Affiliates
General Reditus
Adding the Reditus Snippet
The Snippet is one line of code that should be inserted after a successful signup submission, sending us the actual email of the person signing up (So make sure you change email@example.com with the actual email of the person signing up).
See below for more information on how to implement it.
- Adding the Reditus Snippet
- Information about the snippet
- How does the Snippet work?
- Where do I find the Snippet?
- How to add it to your sign up form
- Ruby
- Ruby
- # React JS
- JavaScript
- Frequently Asked Questions
Information about the snippet
For us to identify a partner-related sign up we need to track if people sign up. Before installing the snippet make sure you have added the tracking script to your website. We only store signups which have an active partner cookie.
How does the Snippet work?
The cookie will track all the partner-related visitors. The next step you want your visitors to take is to actually sign up. When a referral signs up we want to know his email to keep track of this referral from now on forward. The email will get shown in the partner dashboard, your dashboard plus we will keep track of it in your Stripe account.
Where do I find the Snippet?
You can find the Snippet within your settings. Make sure you copy using the button to avoid any typos.
How to add it to your sign up form
# Ruby on Rails
We would need to know if registration occurred on your application, so we can mark a new referral into Reditus.
For that to happen, you need to manually call gr("track", "conversion", { email: "actual@email.com" }); when a user successfully signed up.
Below you will find an example of tracking a successful user registration, using devise gem.
# app/controllers/users/registrations_controller.rb
Ruby
class RegistrationsController < Devise::RegistrationsController
def create
#...
resource.save
if resource.persisted? # Account created
session[:reditus_referral] = sign_up_params[:email]
#...
else # Authentication failed
# ...
end
end
end
Notice we are storing the email of the newly created user in session[:reditus_referral].
Next, you need to properly call the tracking method that tells Reditus a new user has registered.
In the rendered view, after the registration redirect, we check if there is anything cached in session[:reditus_referral].
# app/views/layouts/application.html.erb
Ruby
<!DOCTYPE html>
<html lang="en">
<head>
<!-- content in head -->
</head>
<body>
<!-- content in body -->
<% if session[:reditus_referral].present? %>
<script>
# Change with the actual script from your settings.
(function(w, d, s, p, t) { w.gr = w.gr || function() { w.gr.q = w.gr.q || []; w.gr.q.push(arguments); }; p = d.getElementsByTagName(s)[0]; t = d.createElement(s); t.async = true; t.src = "https://app.getreditus.com/gr.js?_ce=60"; p.parentNode.insertBefore(t, p); })(window, document, "script");
# Make sure to use your own website_id
gr("website", "XX");
gr("track", "pageview");
</script>
<% else %>
<script>
# Change with the actual script from your settings.
(function(w, d, s, p, t) { w.gr = w.gr || function() { w.gr.q = w.gr.q || []; w.gr.q.push(arguments); }; p = d.getElementsByTagName(s)[0]; t = d.createElement(s); t.async = true; t.src = "https://app.getreditus.com/gr.js?_ce=60"; p.parentNode.insertBefore(t, p); })(window, document, "script");
gr("website", "XX");
# Use the actual email, found in `session[:reditus_referral]` in this example
gr("track", "conversion", { email: "actual@email.com" });
</script>
<% end %>
</body>
</html>
# React JS
We would need to know if registration occurred on your application, so we can mark a new referral into Reditus.
For that to happen, you need to manually call gr("track", "conversion", { email: "actual@email.com" }); when a user successfully signed up.
In a React app, we will usually call the conversion event, in the callback of the Sign Up success handler.
JavaScript
handleSignupSubmit(values) {
const {
signUp,
} = this.props
signUp({
...values,
})
.then(() => {
gr("track", "conversion", { email: "actual@email.com" });
console.log('Account created successfully.')
})
.catch((err) => {
console.log('Something went wrong. Please try again later!')
})
}
Frequently Asked Questions
The conversion snippet needs to see an active cookie to return something. So if there is no cookie, gr will be undefined.
A cookie is either set by using a referral link (from a partner) or by using the verify button when testing the snippet.
We offer live chat support during EU hours, always feel free to send us a message if you need more hel0