Tracking UTM Campaign information in CRM

Tracking UTM Campaign information in CRM

Hi All,

We have had this questions asked a few times lately so thought it would be a great idea to post it here for others benefit. 

Many have asked this:
How can I track campaign information in CRM from my online campaigns and report on UTM tracking details? 

Below is what we have set up for other businesses who are using UTM Codes for all their campaigns. Follow the 4 steps below to set this up for your CRM:

1. Create Fields in CRM Leads Module

Add a field  in the Leads module called 'Referrer URL' (URL field type).

Added a section in the Leads module called 'UTM - Campaign Details' and add these fields (Single Line field type):
  • Campaign Name
  • Campaign Source
  • Campaign Medium
  • Campaign Term
  • Campaign Content
2. Create a Custom Function

Next you will need to configure a Custom Function that takes the UTM tracking details from the 'Referrer URL' and adds them to the UTM fields above in the Leads module. Here is the custom function code that you will need to also create in your CRM (to create a Custom Function go to CRM 'Settings' => 'Automations' => 'Actions' => 'Custom Functions' (on the top), then click 'Configure Function' button on the right):

Set this up for your Leads module.
Custom Function Name: Add UTM tracking details to Lead Fields

Argument Mapping - Name: leadId = Value: Lead Id

(copy and paste this code to your custom function. If you have set the Argument above exactly the same it should work for you)

getLeads = zoho.crm.v1.getRecordById("Leads",leadId);
referrerUrl = getLeads.get("Referrer URL");
info referrerUrl;
urlVal = referrerUrl.indexOf("?");
customVariables = referrerUrl.substring(urlVal + 1);
utm_source = "";
utm_medium = "";
utm_campaign = "";
utm_term = "";
utm_content = "";
formMap = Map();
for each  customVariablesArr in customVariables.toList("&")
{
var_s = getPrefix(customVariablesArr,"=");
val_s = getSuffix(customVariablesArr,"=");
if(var_s == "utm_source")
{
utm_source = val_s;
}
if(var_s == "utm_medium")
{
utm_medium = val_s;
}
if(var_s == "utm_campaign")
{
utm_campaign = val_s;
}
if(var_s == "utm_term")
{
utm_term = val_s;
}
if(var_s == "utm_content")
{
utm_content = val_s;
}
}
formMap.put("Campaigns Source",utm_source);
formMap.put("Campaign Medium",utm_medium);
formMap.put("Campaign Name",utm_campaign);
formMap.put("Campaign Term",utm_term);
formMap.put("Campaign Content",utm_content);
leadupdated = zoho.crm.v1.updateRecord("Leads",leadId.toString(),formMap);
info leadupdated;

3. Create a Workflow Rule to trigger the Custom Function

To run the above code a Workflow Rule needs to be created. We created a workflow rule WHEN a Lead is Created or is Edited to meet the condition:
Condition 1 - Referrer CONTAINS utm

Instant Action - (select the Function you created above) 

4. Create a hidden field in your online forms for 'Referrer URL' and map to your CRM Leads module

You will need to have a field added to your campaign forms that captures the 'Referrer URL' you set up for your UTM tracking. Add this field and then make it hidden and then map this form field to the 'Referrer URL' field in your leads module. 

That's it! Once you have this set up you can create reports in your CRM to report on any of the Lead UTM fields. 

Please let a comment if this post has been helpful to your business. We would love to hear from you!

If you need any help with this please send us an email to - zoho(at)s2s(dot)services.

Helping you achieve business and personal success using Zoho Products

Jason



    • Sticky Posts

    • Function #37: Create a Purchase Order from a Quote

      Welcome back everyone! Last week, we learnt how to calculate the total number of activities for a lead and further take note of the activity count for particular dates. For instance, from the period of Demo to Negotiation. This week, let's look at a function that lets you create a Purchase Order instantly from a Quote. Business scenario: In any form of business, one of the most important things to do is to document the transactions. Naturally, negotiation, signing an agreement, placing an order,
    • Function-1: Compute and update sales commission in quotes.

        Welcome back folks! In this week's custom functions series, we've picked a requirement that has often been asked by users! Business requirement: In most sales organizations, commissions are an integral part of the extrinsic rewards program, contributing significantly to the sales person’s compensation package. Sales commission is usually calculated as a percentage of revenue generated by the sales person. What if your sales team is enabled with an option to check their sales commission associated
    • Function-2: Round-Robin assignment of records

      Welcome back folks! Last week, we saw how to update sales commission in quotes using a custom function. This week, let's see an interesting use case asked by many of you - auto-assignment records by round-robin method. Business scenario: Right now, the solution allows you to auto-assign leads from web form and imported lists. Let us look at a need where you want to auto-assign leads from in-bound calls in a round-robin method, across modules. Prerequisite: You must create a permanent record in the
    • Zoho CRM Functions 53: Automatically name your Deals during lead conversion.

      Welcome back everyone! Last week's function was about automatically updating the recent Event date in the Accounts module. This week, it's going to be about automatically giving a custom Deal name whenever a lead is converted. Business scenario Deals are the most important records in CRM. After successful prospecting, the sales cycle is followed by deal creation, follow-up, and its subsequent closure. Being a critical function of your sales cycle, it's good to follow certain best practices. One such
    • Custom Function : Updating Lead Score.

      Scenario: Updating Lead Score. You may want to rank the leads in your CRM account in order to determine their sales-readiness. The scoring can be based on certain predefined values. This lead scoring can be done with custom functions. You can have a custom field for the Score and use custom functions to update the Lead Score based on certain values. When you update the fields in leads, the score will be updated automatically.   This custom function can also be used for other modules by making small

            Zoho DataPrep Resources


                Zoho CRM Plus Resources

                  Zoho Books Resources


                    Zoho Subscriptions Resources

                      Zoho Desk Resources

                        Zoho Projects Resources


                          Zoho Sprints Resources


                            Zoho Orchestly Resources


                              Zoho Creator Resources


                                Zoho WorkDrive Resources




                                    Zoho Campaigns Resources

                                      Zoho CRM Resources

                                                  Design. Discuss. Deliver.

                                                  Create visually engaging stories with Zoho Show.

                                                  Get Started Now




                                                      Zoho Writer Writer

                                                      Get Started. Write Away!

                                                      Writer is a powerful online word processor, designed for collaborative work.