The following are some key things to note about the Email capture JavaScript event:
- See this article for even more detail.
- Our recommendation is to use Import API to create new users, this JavaScript should only be used in limited scenarios.
Double-check your website and form behavior: The email-entered action creates a user who is opted into email, after which the user can only be unsubscribed. Make sure that the user has a chance to explicitly opt-in before your forms trigger this action. |
Email capture event details
The email capture event is used for collecting emails signups through email forms.
Required fields:
- record_id:
- This record_id should match the record_id being passed via flat file.
- If you cannot provide the record_id at the time this pixel is fired, set record_id to an md5 encoding of the email lower-cased (i.e. md5(lowercase(email))).
- Note: Shopify and Magento stores will have to set record_id to an md5 encoding of the email lower-cased (i.e. md5(lowercase(email))).
- This record_id should match the record_id being passed via flat file.
- email:
- This email should match the email being captured.
Optional fields
- registration_source
- full_name
- address1
- address2
- city
- state
- zip
- country
- phone
- birthday
- gender
You can also pass any ReSci User attribute data in our Email Capture Event (Note: This will only be set once on user creation)
/*** EVENT SPECIFIC CODE ***/ _rsq.push(['_setUserEmail', uEmail]); _rsq.push(['_setUserProperties', { 'record_id':'93942e96f5acd83e2e047ad8fe03114d', 'email':'test@email.com', 'registration_source':'source',
'full_name': 'John Smith',
'address1': '123 Test Street',
'address2': 'APT 1',
'city': 'Santa Monica',
'state': 'CA',
'zip': '90405',
'country': 'US',
'phone': '12345678',
'birthday': '1990-01-01',
'gender': 'M' }]); _rsq.push(['_setAction', 'email_entered']); /*** END EVENT SPECIFIC CODE ***/
Email capture code sample
<!-- RetentionScience start --> <script type='text/javascript'>
var _rsq = _rsq || []; _rsq.push(['_setSiteId', 'site_id']); // replace site_id with your static Site ID _rsq.push(['_enableOnsite']); document.getElementById("contact-form").addEventListener("submit", function(){ var uEmail = document.getElementById('contact_email').value;
// replace contact_form and contact_email with the id of the newsletter form and email field /*** EVENT SPECIFIC CODE ***/ _rsq.push(['_setUserEmail',uEmail]); // replace db-user-id with an md5 hash of the lowercased email address _rsq.push(['_setUserProperties', { 'record_id':'db-user-id', 'email':uEmail, 'registration_source':'source' // OPTIONAL: replace source with source of email capture (ex: footer) }]); _rsq.push(['_setAction', 'email_entered']); _rsq.push(['_track']); }); /*** END EVENT SPECIFIC CODE ***/
_rsq.push(['_track']); });
(function() {
var rScix = document.createElement('script');
rScix.type = 'text/javascript';
rScix.async = true;
rScix.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'd1stxfv94hrhia.cloudfront.net/waves/v3/w.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(rScix);
})();
</script> <!-- RetentionScience end -->
Comments
0 comments
Please sign in to leave a comment.