1
votes

I see that on certain pages the event hits are being send to google analytics before the pageview hit is being send. This is causing some problems in my reports. I always thought that when the pageview trigger is fired before the event trigger, the same order would be applied for the sequence of the firing of the tags, but apparently it's not. What would be the best way to always fire the pageview tag before anyother tag is being fired?

Thanks in advance!

4

4 Answers

1
votes

Honestly, the event tags depend on the triggers you have defined. It might be the case you have fired the event on DOM Loaded, and page view on Window loaded. In short, it all depends on how you create the triggers and use them to fire tags.

If you know which event tags are firing before Pageview, you can use the GTM feature known as Tag Sequencing as its purpose is to facilitate the sequential firing of Tags.

You can define that the particular event tag must fire after the pageview tag. Your problem would be resolved. Its present under ag Firing Options in Advanced settings

1
votes

You can use GTM's "Tag firing priority": https://support.google.com/tagmanager/answer/2772421?hl=en

In your GA tag under Advanced settings:

enter image description here

Set "Tag firing priority" of your pageview Tag to "1".

Set "Tag firing priority" of your event Tag to "0" or lower.

1
votes

Try Using tag sequencing, GA tracking should fire before your event tag. But make shure to limit the ga tracking to once per page, if not you will be firing twice the analytics code.

0
votes

Reading your scenario, its possible tag sequencing might have unintended consequences. Since it's like adding a new trigger to the event tag - it would make a specific event tag always trigger after the pageview tag, regardless of the triggers it already has in place.

So you'd only want to use this if you always wanted the event tag to fire after the pageview. If the event tag is only triggered on some pages, you'd want to avoid this.

Similarly you would also need to remove your current triggers from your event to stop them firing before the pageview.

Instead, if the events are triggered for a certain URL, update them to trigger on gtm.dom (when the page's dom has loaded) or even gtm.load (when the whole page has finished loading) rather than gtm.js (when the gtm script first executes, which is the default used by your pageviews).

That means they should always trigger later in the GTM load process than pageviews, without forcing them to trigger on every single page.