The feature described in this post was added to Full Picture v. 4.0.0
This post requires at least intermediate knowledge of how GTM works.
Let’s say, that your visitor opened a store category page with 6 products in the category and additional 4 in the sidebar. In total we have 10 product teasers.
Full Picture counts views of these teasers, puts them into an array like this
[1a, 2a, 3a, 4a, 5a, 6a, 7a, 8a, 9a, 10a] and pushes it to the dataLayer.
At this point the dataLayer holds an array with 10 product views:
[1a, 2a, 3a, 4a, 5a, 6a, 7a, 8a, 9a, 10a].
You can instruct your tags in GTM to grab this value and track it. So far, easy peasy.
But the problem begins…
The problem – unexpected behavior of the dataLayer
To follow with the example above, let’s say that your website loads 6 more products into the category page every time the visitor reaches the end of it.
When this happens, Full Picture pushes to the dataLayer 6 product views
[1b, 2b, 3b, 4b, 5b, 6b].
Now, a question for you.
What product views does the dataLayer array now holds?
[1b, 2b, 3b, 4b, 5b, 6b]
[1a, 2a, 3a, 4a, 5a, 6a, 7a, 8a, 9a, 10a,
1b, 2b, 3b, 4b, 5b, 6b]
[1b, 2b, 3b, 4b, 5b, 6b, 7a, 8a, 9a, 10a]
The first one seems an obvious one. After all if you want to track product views with GTM then you need to know what products were added. Unfortunately, it is incorrect.
The second option seems also likely. You may think that the dataLayer will add 2 arrays together to give you a list to all viewed products. Unfortunately, it is also incorrect.
The correct answer is “3”!
GTM will join the arrays but if the original one is longer than the following one, than only a part of its elements will be overwritten.
This is a big problem.
If new products are added 10 times and you track product views on every event (so how you should be doing that) you will end up with very odd data.
You will see that products 7a, 8a, 9a and 10a were viewed 11 times each! Once for the initial category load and 10 more times extra products were added.
The solution – preventing partial overwrites of product lists
Every time a new product list is pushed to the dataLayer (for example with products added to cart, purchased products or vierwed products) Full Picture clears the previous array of products.
This always gives you a clear list of products that were a part of an event.
In other words, when new products load your datalayer will always hold only the information of the newly added – like in point 1 above – and not the combined one – like in point 3 above.