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?
- When configuring a rule (tag or dataLayer), click on the three small dots
...and select Add a constraint. - Define the constraint condition, based on a collector.
- Example:
{{Connection Status}}must be exactlyconnected.
- Example:
- When configuring a rule (tag or dataLayer), click on the three small dots
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 is19.99.- The rule
{{DataLayer Price}}must be exactly{{Displayed Price}}will fail. - Solution: Apply a modifier on the collector
{{Displayed Price}}.
- The rule
- How?
- In the "Value" field of a rule, to the right of your collector, click on the magic wand icon.
- Select one or more modifiers from the list.
- Available modifiers:
Numeric: Keeps only digits, the dot and the dash.Transform to lowercase/Force uppercaseSpace 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.
- On a category page, the dataLayer contains a list of 12 products:
- How?
- Create a tag rule and click on
...> Add a dynamic parameter. - Based on collector: Indicate the collector that returns the reference list (e.g.
{{dataLayer.ecommerce.impressions}}). - Parameter: Use special variables to construct the parameter name.
pr{{__index}}id:__indexwill be replaced by 1, 2, 3...pr{{__key}}id:__keywill be replaced by the array index (0, 1, 2...) or the key of an object.
- Value: Use
{{__value}}to refer to the current element of the list.{{__value}}.id: Will take theidproperty of the product object currently being iterated.
- Create a tag rule and click on
- The final rule will read: "For each element of the list
dataLayer.ecommerce.impressions, verify that the tag parameterpr{{__index}}idis exactly equal to the value of{{__value}}.id."