Retainly Support

            How to use the Retainly Tracking Script

            Developer Knowledge Required. 

            The Retainly Tracking Script is very useful for SaaS products and for those bloggers who offer a membership module. The tracking script automatically tracks new Signups and adds them as contacts in your Retainly Default List. The script can also track events triggered by your customer's behavior which can be used for Real Time Behavioural Marketing.   

            Login to your Retainly application and navigate to Settings, where you will find your own JS Tracking Script.  Below is the sample Script.
            1. <script>
            2.     window.retainlySettings = {        
            3.       app_id: "589ae9dd63321",        
            4.       company: "Name of the company",         
            5.       email: "[email protected]",         
            6.       signedup_at: "2017-02-22",        
            7.       plan: "Premium" 
            8.       };
            9. </script>

            Elements of this Script
            1. app_id: Is your unique id which is autogenerated by Retainly. Do not change it. 
            2. company: It is an optional field that can help you to group your contacts. You can change the value field. If you use server variables, you can use something like  company: "<?php echo $company;?> "
            3. email: Email Id of the user that you willing to track. This is a mandatory field. if you use server variable, you can use like  email: "<?php echo $logged_mail;?>"
            4. singedp_at : This is optional, but can be useful to plan your drip based on the signup date on your app/website. It is the value of the variable to denote when the user is created. Server Variable can be used as  signedup_at: "<?php echo $singedupdate;?>"  
            5. plan: Another optional field which helps you to capture the plan or package selected by your customer, and can be changed as per your need. Server variables can be used as plan: "<?php echo $plan; ?>"

            The Script Function
            The script below automatically tracks the page visits based on the user configuration.

            You need to add this script as it is, in all your pages, ideally in your footer. And ensure the above script too has set before this

            1. <script>
            2. (function(){var w=window;var d=document;var r=function(){r.c(arguments)};r.q=[];r.c=function(args){r.q.push(args)};w.retainly=r;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src=''+retainlySettings.app_id;var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}})()
            3. </script>

            The Event Tracking Script

            You need to add this script in all your web pages where you want to capture an event from your site/app. 
            This script will track your defined events triggered by your users. These events can be later used inside Retainly to automatically send real-time behavioral campaigns. 

            1. <script>
            2. TrackEvent('Product Clicked',JSON.stringify({'name':'ABC Item','price':'100'}));
            3. </script>

            The script provided above is an example. 'Product Clicked' is the event name. You can create and name any event depending on your application. The second part of this script is a JSON object which is optional.

            Other Examples
            <script>TrackEvent('New Bank Account Linked');</script>

            <script>TrackEvent('New Stock Purchased');</script>

            <script>TrackEvent('New Trade Eqnuiry');</script>

            Add Contacts
            For any newly signed-up contact to be captured in your retainly account, please call the below javascript.


            Please note that TrackEvent, Identify function etc., are to be called after loading the retainly script.

            What are the possible fields that can be tracked?
            The below list has the complete set of fields that can be used inside window.retianlySettings

            Nickname or nice name of the contact
            Email ID of the contact. This is mandatory field
            This is the signed up date of your contact in your application/db
            If the contacts is to be associated with any plan in your app, you can use this field
            Title of the contact. E.g., Mr. Ms. etc.,
            Firstname of the contact
            Lastname of the contact
            Gender of the contact
            Birthday of the contact. Pass the values in YYYY-MM-DD format
            Address of the contact
            City of the contact
            State or region of the contact
            Country of the contact
            Posta code / zip code of the contact
            Country code of the contact
            Phone / Mobile number of the contact
            Website of the contact
            You can pass the list/segment name where the contact needs to be grouped in Retainly. e.g., Leads, Customers
            Tags that you want to add to this contact. Use comma separated lists like Beta, Demo
            Company of the contact. Will be useful to group them into accounts
            Revenue that was charged with this contact
            Avatar URL of the contact

            Updated: 03 Jul 2017 10:24 PM
            Help us to make this article better
            1 0