Skip to main content

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 
  1. Create new parameters based on existing UTM parameters or tracked fields.

    • Implement

      Implement complex tracking complex tracking logic specific specific to your marketing marketing campaigns.

    • Customize

      Customize parameter values parameter values based on certain certain conditions.

    • Enhance

      Enhance your analytics by your analytics by creating more more detailed or or specific tracking tracking parameters.

How How to Access Access the Feature

1.

    Log 
  1. Log in to your WordPress admin admin panel.

    • Navigate

      Navigate to the HandL UTM Grabber settings.

    • Click on on the "Define Your Own" tab in in the settings settings 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 
  1. A condition based on an existing parameter

    • A new parameter to be be created when when 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

  • In In the "Define Your Own" tab, you'll see a table where table where you can add custom custom logic rules.
  1. 2.For For each rule, follow follow these steps:

    a. Select the parameter the parameter you want to base your your condition on from the first first dropdown.

    b. Choose an Choose an operator from the second dropdown to dropdown to define how you how you want to compare the parameter's value.

    c. Enter Enter the value you want to to compare against in the text text field.

    d. In the In the "Then Then set" section, enter a name enter a name for your your new parameter.

    e. Enter the Enter the value you want to assign assign to this this new parameter when when the condition is met.

  • You

    You can add multiple rules by filling by filling out additional additional rows in the table.

  • Click

    Click the "Save Changes" button to apply apply your custom logic rules.

Examples

  1. 1. Campaign Source Campaign Source Tracking:

    • If

      If utm_source equals equals "facebook"

    • Then set "social_campaign" = "fb_promo"
  2. ThenContent set "social_campaign" =Type "fb_promo"Flagging:

    • Content Type Flagging:

    • If utm_content utm_content contains "video"

    • Then

      Then set "content_type" = "video_ad"

  3. Specific Specific Campaign Tracking:

    • If utm_campaign starts_with "summer2023"

    • Then set "seasonal_campaign" =  "summer_promo"

  4. 4. Excluding Certain Excluding Certain Traffic:

    • If referrer not_contains "ourpartner.com"

    • Then set set "non_partner_traffic" = "true"

  5. 5. Advanced Regex Regex Matching:

    • If utm_term utm_term matches regex regex "^(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 
  1. Use meaningful names for your new new parameters to ensure ensure they're easily re easily understood in in your analytics.

    • Be

      Be cautious with regex with regex operations, as they can be more be more resource-intensive.

    • Regularly

      Regularly review your your custom logic to to ensure it's still relevant to relevant to your current current marketing strategies.

    • Test

      Test your logic logic thoroughly to make make sure it's working as as expected.

Limitations

  • The custom custom logic is is evaluated when when the page loads, so it so it won't react react to changes in UTM UTM parameters without without a page refresh.

  • Be

    Be mindful of creating creating too many custom parameters, as this this can lead to cookie cookie bloat and potentially potentially impact site site performance.

Troubleshooting

If your If your custom logic isn't working working as expected:

  • Check that that the parameter parameter you're basing your condition on is is being correctly correctly set.

  • Verify

    Verify that your condition values your condition values are correct correct and watch watch for typos.

  • Use

    Use your your browser's developer tools to check to check if the new cookies new cookies are being set correctly.

  • Ensure that your site visitors have site visitors have consented to cookies if cookies if you're using using GDPR compliance compliance 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.