Skip to main content

Advanced Rule Configuration

For more complex use cases, Netvigie Tracking offers powerful tools to refine your rules.

Constraints: conditioning the verification

A constraint is a prerequisite condition for the verification of a rule. If the constraint is not satisfied, the main rule is not tested, and no error is raised.

  • When to use it?
    • For parameters that only exist for logged-in users.
    • For rules that only apply on mobile.
    • To verify consent compliance (see GDPR section).
  • How?
    1. When configuring a rule (tag or dataLayer), click on the three small dots ... and select Add a constraint.
    2. Define the constraint condition, based on a collector.
      • Example: {{Connection Status}} must be exactly connected.

Data modifiers: transforming values

Sometimes, the received value and the expected value are not identical but should be after a small transformation. Modifiers allow applying this transformation on the fly, without generating a false error.

  • Common example: The price displayed on the page (via a CSS collector) is "19,99 €", but the value in the dataLayer is 19.99.
    • The rule {{DataLayer Price}} must be exactly {{Displayed Price}} will fail.
    • Solution: Apply a modifier on the collector {{Displayed Price}}.
  • How?
    1. In the "Value" field of a rule, to the right of your collector, click on the magic wand icon.
    2. Select one or more modifiers from the list.
  • Available modifiers:
    • Numeric: Keeps only digits, the dot and the dash.
    • Transform to lowercase / Force uppercase
    • Space to dash, Dash to space, etc.
    • Trim: Removes spaces at the beginning and at the end.
    • ...and many others to manage accents, punctuation, etc.

Dynamic parameters: verifying lists of elements

This feature is designed to verify data that appears in the form of lists, such as product impressions on a category page.

  • Use case:
    • On a category page, the dataLayer contains a list of 12 products: ecommerce.impressions: [{id: 'A', name: 'ProdA'}, {id: 'B', name: 'ProdB'}, ...].
    • The Google Analytics tag sends this information via numbered parameters: pr1id=A, pr1nm=ProdA, pr2id=B, pr2nm=ProdB, etc.
    • You want to verify that for each product, the ID and the name are correct.
  • How?
    1. Create a tag rule and click on ... > Add a dynamic parameter.
    2. Based on collector: Indicate the collector that returns the reference list (e.g. {{dataLayer.ecommerce.impressions}}).
    3. Parameter: Use special variables to construct the parameter name.
      • pr{{__index}}id: __index will be replaced by 1, 2, 3...
      • pr{{__key}}id: __key will be replaced by the array index (0, 1, 2...) or the key of an object.
    4. Value: Use {{__value}} to refer to the current element of the list.
      • {{__value}}.id: Will take the id property of the product object currently being iterated.
  • The final rule will read: "For each element of the list dataLayer.ecommerce.impressions, verify that the tag parameter pr{{__index}}id is exactly equal to the value of {{__value}}.id."