UTM tags in LiveChat

When creating a new session with a user who contacted via the LiveChat, the following UTM tags are automatically captured in ELMA365:

  • utm_source. The source of the transition.;
  • utm_medium. Traffic type;
  • utm_campaign. The name of the ad campaign;
  • utm_content. Additional information that helps to distinguish ads;
  • utm_term. Key phrase.

With these tags, you can track where the most potential customers come from and what topics are most in demand. Captured tags are displayed on the session page on the right sidebar of the chat.

You can also pass tag values to a business process. To do this, use Script. For example, you can set up a process where UTM tag values will be output to the lead page after the lead is automatically created. Read more about scripting in the ELMA365 TS SDK in the Live Chats workspace.

Example of using UTM tags in a business process

Let’s consider an example where when creating a new session with a user from LiveChat in ELMA365, a new lead will be automatically created using a business process. At the same time, captured UTM tags will be displayed on the lead page.

  1. Go to the Leads app in the CRM workspace.
  2. Click the gear icon next to the app name and select Business Processes.
  3. In the upper right corner, click +Process. In the opened window, enter the name of the process, for example, Creating a lead from a session.
  4. In the opened business process designer, open the Context tab and add a variable with the following parameters:
  • Display name*. Lead.
  • Property Name*. Opportunity.
  • Type*. App, One.
  • App*. Leads.
  1. Then create another variable:
  • Display name*. Session ID.
  • Property Name*. Session_id.
  • Type*. String.
  1. Go to the Scripts tab and add the following code:

async function createOpportunity(): Promise<void> {
    
    if(Context.data.session_id) {
        
        const session = await System.lines.sessions.search().where(item => item.__id.eq(Context.data.session_id!)).first();
        if(session && session.data._clients && session.data._clients.length > 0) {
            
            const client = await System.lines.clients.search().where(item => item.__id.eq(session.data._clients![0].id)).first();
            if(client) {
 
                if(client.data._applicationItem) {
                  
                    const new_opportunity = await Context.fields.opportunity.app.create();
 
                    new_opportunity.data._contacts = [client.data._applicationItem as any];
                    new_opportunity.data.utm_source = (<any>client.data._extraData).utm_source;
                    new_opportunity.data.utm_medium = (<any>client.data._extraData).utm_medium;
                    new_opportunity.data.utm_campaign = (<any>client.data._extraData).utm_campaign;
 
                    await new_opportunity.save();
 
                    Context.data.opportunity = new_opportunity;
                }
            }
        }
    }
}

  1. Go to the Flow chart tab and place the Script element on the modeling field. Double-click on it and in the opened settings window in the Function field specify the createOpportunity function created on the Scripts tab. Click Save.

In our example, only the Script element is sufficient for automatic lead generation and UTM tagging, so the process flow chart can look like this:

utm1

  1. On the top panel of the business process designer, click Save, and then Publish.
  2. Bring up the properties for UTM tags in the view page of the lead. To do this, click the gear icon to the right of the Leads app name and select Form Settings. In the opened window, click the View tab and bring the properties for UTM tags located in the left panel to the form:

utm2

  1. Save the form and go to the Administration > Live Chat workspace.
  2. Open the Business Processes tab. Opposite When a new session is created, click Select and specify the previously created process Creating a lead from a session.
  3. In the Input parameters column, click Configure. In the opened window, click +Field and select the Session ID property created in step 5. In the Live Chats app field column, specify Session > ID.

utm3

  1. Click Save. After closing the window, save the changes made to the Business Processes tab.

After that, when creating a new session with a user from LiveChat, a new lead will be created in the CRM workspace, and its page will display the captured UTM tags.

Found a typo? Highlight the text, press ctrl + enter and notify us