Created
April 27, 2012 20:27
-
-
Save sud0n1m/2512743 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This should work well. We'll use the "plan" variable. When a user signs up it will be blank. | |
* When they complete the process, it should be "Premium" or whatever you would call your plan. | |
* Using the created at date, we'll send users an email X days after signup if the plan is blank. | |
*/ | |
<script type="text/javascript"> | |
var _cio = _cio || []; | |
(function() { | |
var a,b,c;a=function(f){return function(){_cio.push([f]. | |
concat(Array.prototype.slice.call(arguments,0)))}};b=["identify", | |
"track"];for(c=0;c<b.length;c++){_cio[b[c]]=a(b[c])}; | |
var t = document.createElement('script'), | |
s = document.getElementsByTagName('script')[0]; | |
t.async = true; | |
t.id = 'cio-tracker'; | |
t.setAttribute('data-site-id', 'YOUR SITE ID HERE'); | |
t.src = 'https://app.customer.io/assets/track.js'; | |
s.parentNode.insertBefore(t, s); | |
})(); | |
/* Only display this if your users are logged in. This is in Ruby */ | |
<% if user_signed_in? %> | |
_cio.identify({ | |
id: 'production_34', // must be unique per customer | |
email: '[email protected]', | |
created_at: 1333688268, // seconds since the epoch (January 1, 1970) | |
name: 'Joe', | |
plan: 'premium' | |
}); | |
<% end %> | |
/* this ends the ruby conditional */ | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment