Skip to content

Preload Groups

Preload Groups allow you to organize placements into logical groups that should be loaded together. This is useful for coordinating the loading of related placements.

When placements are assigned to the same preload group, Htag ensures that they are loaded together. Note that their rendering is still async and not binded together, preload groups only affect the loading process.

Groups are determined by string equality - placements with identical preload group strings will be treated as part of the same group. This means that "header" and "header" are the same group, but "header" and "Header" are different groups (case-sensitive).

Preload groups follow these specific rules:

  • Any string value: The preload group can be any string value you choose
  • String equality: Groups are considered the same if and only if their string values are exactly equal
  • Case sensitive: "sidebar" and "Sidebar" are treated as different groups
  • Empty string behavior: An empty string ("") is treated as no group at all, meaning placements with empty preload groups will not be grouped together

Preload groups are configured at the placement level using the preloadGroup parameter when defining a placement with the definePlacement method.

Placements with the same preload group value will be treated as part of the same group. If preload groups are not specified, placements will be treated as separate groups.

  • Placements: Learn more about placement configuration
  • Lazy Loading: Learn about delayed loading of placements