Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Priority of tags does not apply if trigger is different #786

Open
DarkLink571 opened this issue May 3, 2024 · 9 comments
Open

Priority of tags does not apply if trigger is different #786

DarkLink571 opened this issue May 3, 2024 · 9 comments

Comments

@DarkLink571
Copy link

When two or more tags are fired at the same time, the priority of the tags is not used if the tags don't have the same trigger.

Steps to reproduce:

  • Create two identical (except for the name) triggers.
  • Create two tags, each uses one of the triggers.
  • Set the priority of the tags to different values.
  • Open the preview and trigger both triggers.
  • Switch the priority of the two tags.
  • Open preview again and trigger both triggers again.
  • The order of the tags will be the same in each case.

I guess this is not the expected behaviour and I haven't found an open issue for this yet.

@snake14
Copy link
Contributor

snake14 commented May 5, 2024

Hi @DarkLink571 . Thank you for taking the time to create this issue. Reading through your description, I would say that's actually the expected behaviour. If both tags used the same trigger and the priority wasn't honoured, that would be an issue. However, if they use different triggers, there isn't really a clear way to enforce the priority as they could be triggered at very different times. Even being triggered at relatively the same time, since the triggers were different, the tags are processed separately. Do you have any insights on this @AltamashShaikh ?

@AltamashShaikh
Copy link
Contributor

@snake14 You are correct, @DarkLink571 Can you please elaborate more on what seems to be incorrect for you ?

@DarkLink571
Copy link
Author

Hi @snake14 and @AltamashShaikh
If the two different triggers will trigger under the same conditions, for example when I use two pageview triggers but with different extra conditions, I would assume all tags that should be fired on a pageview will be ordered by priority, independent of the trigger that triggers them.

@AltamashShaikh
Copy link
Contributor

@DarkLink571 Can you share the screenshot of 2 triggers ?

@DarkLink571
Copy link
Author

ConversionPageview ConversionTag Pageview SetupTag

Here is an example of what I expected to work. The setup tag should fire on every page and it is important for it to always fire before the conversion tag.

@AltamashShaikh
Copy link
Contributor

@DarkLink571
I just tried this created a function in my HTML file where we have included the MatomoTagManagerCode.

<script>
    function trackCustom(trackingType) {
        console.log(trackingType, 'trackingType');
    }
</script>

Now created 2 tags to fire on pageView trigger

  1. Custom HTML should fire first (priority: 1) -> trackCustom('pageView');
  2. Custom HTML should fire second (priority: 10) -> trackCustom('conversion');

I can see "Custom HTML should fire first" being executed first and "Custom HTML should fire second" after that.

Screenshot from 2024-05-24 20-03-59

Screenshot from 2024-05-24 20-08-17

Just FYI. the priority should be lower if you want it to execute first.

@AltamashShaikh
Copy link
Contributor

Custom HTML should fire first
tag_first

Custom HTML should fire second
tag_second

@DarkLink571
Copy link
Author

This is not exactly what I meant. In this example, the setup of the tracking function should also be done in the Tag Manager and not be hardcoded. The pageview tracking may be included in this snippet (e.g. in some Google snippets the gtag is loaded and used in the same code-block). I left out the pageview tracking since it wasn't important for the example.

The important part is: Two different tags may fire on the same event but not the same trigger. The order of the tags cannot be controlled with the priority. In the example I gave, an error may occur because the tracking function is not defined despite the tag loading the function triggers on the same event and has a higher priority.

@AltamashShaikh
Copy link
Contributor

@DarkLink571 If its a different trigger, even though the functionality is same, it won't work the way you are saying, we would recommend you to trigger the 2nd tag on a customEvent trigger and fire the customEvent after the first tag is fired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants