Define Your Own Custom Logic
Introduction
The "Define Define Your Own" feature in in HandL UTM UTM Grabber v3 v3 allows you to create custom custom logic for tracking for tracking and manipulating UTM parameters and other other tracked fields. This powerful tool enables powerful tool enables you to define conditional define conditional rules that create create new parameters parameters based on existing ones, giving giving you more more control over your tracking and marketing marketing efforts.
When When to Use This This Feature
Use the Use the "Define Your Own" feature when you need to:
1.
- Create new parameters based on existing UTM parameters or tracked fields.
- Implement
Implement complex trackingcomplex tracking logicspecificspecific to yourmarketingmarketing campaigns. - Customize
Customize parameter valuesparameter values based oncertaincertain conditions. - Enhance
Enhance your analytics byyour analytics by creatingmoremore detailedoror specifictrackingtracking parameters.
How How to Access Access the Feature
1.
- Log in to your WordPress
adminadmin panel. - Navigate
Navigateto the HandL UTM Grabber settings. Click
onon the "Define Your Own" tabinin thesettingssettings menu.
Features and Functionality
Creating Custom Custom Logic
The The "Define Your Own" tab tab allows you to create multiple multiple custom logic rules. Each Each rule consists of:
1.
- A condition based on an existing parameter
AA new parameter tobebe createdwhenwhen the condition is met
Available Available Fields
The feature The feature uses all fields generated by the the generateUTMFields()
function, which includes:
If
<select <select name='dyo_logic[<?php echo $items; ?>][utm_param]' id='dyo_logic_utm_param' <?php echo $handl_fields_disabled; ?>
>
<?php foreach ($utmFields as $field): ?>
These fields include standard UTM parameters and additional additional tracked fields provided by the HandL UTM Grabber plugin.
Operators
You can use various operators to define your conditions:
</select>
<select select name='dyo_logic[<?php echo $items; ?>][operator]' id='dyo_logic_operator' <?php echo $handl_fields_disabled; ?>
>
<option option value='equals' <?php selected($operator, 'equals'); ?>>equals
</option>
<option option value='not_equals' <?php selected($operator, 'not_equals'); ?>not >not equals
</option>
<option option value='contains' <?php selected($operator, 'contains'); ?>>contains
</option>
<option option value='not_contains' <?php selected($operator, 'not_contains'); ?>not >not contains
</option>
<option option value='starts_with' <?php selected($operator, 'starts_with'); ?>starts >starts with
</option>
<option option value='ends_with' <?php selected($operator, 'ends_with'); ?>ends >ends with
</option>
<option option value='regex' <?php selected($operator, 'regex'); ?>matches >matches regex
</option>
These operators allow for precise allow for precise control over when your when your custom logic should be applied.
How How to Use the Feature
InIn the "Define Your Own" tab, you'll see atable wheretable where you can addcustomcustom logic rules.
-
2.ForForeach rule,followfollow these steps:a. Select
the parameterthe parameter you want to baseyouryour condition on from thefirstfirst dropdown.b.
Choose anChoose an operator from the seconddropdown todropdown to definehow youhow you want to compare the parameter'ss value.c.
EnterEnter the value you wanttoto compare against in thetexttext field.d.
In theIn the "ThenThen set" section,enter a nameenter a name foryouryour new parameter.e.
Enter theEnter the value you want toassignassign tothisthis new parameterwhenwhen the condition is met.
- You
Youcan add multiple rulesby fillingby filling outadditionaladditional rows in the table. - Click
Clickthe "Save Changes" button toapplyapply your custom logic rules.
Examples
-
1. Campaign SourceCampaign Source Tracking:- If
Ifutm_source
equalsequals "facebook" - Then set "social_campaign" = "fb_promo"
- If
-
ThenContentset "social_campaign" =Type"fb_promo"Flagging: Content Type Flagging:If
utm_contentutm_content
contains "video"- Then
Thenset "content_type" = "video_ad" -
SpecificSpecific Campaign Tracking: If
utm_campaign
starts_with "summer2023"Then set "seasonal_campaign" =
-
4. Excluding CertainExcluding Certain Traffic:If
referrer
not_contains "ourpartner.com"Then
setset "non_partner_traffic" = "true"
-
5.AdvancedRegexRegex Matching:If
utm_termutm_term
matchesregexregex "^(red|blue|green)product$"Then set "color_category" = "primary_colors"
How It How It Works
When a visitor comes When a visitor comes to your site, the the HandL UTM UTM Grabber plugin checks these these custom logic rules. If a condition condition is met, it creates creates a new cookie cookie with the specified parameter name parameter name and value. This information information is then available available for your analytics tools your analytics tools and can can be used in your in your marketing workflows.
Best Best Practices
1.
- Use meaningful names for your
newnew parameters toensureensure they're easilyre easily understoodinin your analytics. - Be
Becautiouswith regexwith regex operations, as they canbe morebe more resource-intensive. - Regularly
Regularlyreviewyouryour custom logictoto ensure it's stillrelevant torelevant to yourcurrentcurrent marketing strategies. - Test
Testyourlogiclogic thoroughly tomakemake sure it's workingasas expected.
Limitations
The
customcustom logicisis evaluatedwhenwhen the page loads,so itso it won'treactreact to changes inUTMUTM parameterswithoutwithout a page refresh.- Be
Bemindful ofcreatingcreating too many custom parameters, asthisthis can lead tocookiecookie bloat andpotentiallypotentially impactsitesite performance.
Troubleshooting
If your If your custom logic isn't working working as expected:
Check
thatthat theparameterparameter you're basing your condition onisis beingcorrectlycorrectly set.- Verify
Verifythatyour condition valuesyour condition values arecorrectcorrect andwatchwatch for typos. - Use
Use youryour browser's developer toolsto checkto check if thenew cookiesnew cookies are being set correctly. Ensure that your
site visitors havesite visitors have consented tocookies ifcookies if you'reusingusing GDPRcompliancecompliance features.
By By leveraging the "Define Your Your Own" feature, you you can create a more a more tailored and powerful powerful tracking solution that meets your solution that meets your specific marketing and analytics needs. This flexibility This flexibility allows you to extract extract more value value from your UTM parameters parameters and other other tracked fields, leading leading to more more insightful data for for your marketing decisions.