In my case, click on a URL is a click on a particular product.
Question:
What is the way to track clicks of a particular product? I mean in Redshift URLs are stored but what is the way to analyze not URL but products.
in your code example, product_id is hardcoded but in a real scenario, product id is dynamic. for 2 different users, it will be shown products with different ids.
Question:
How in this case how implementation should be to handle dynamic product id?
This depends on what platform you are tracking on but typically the best practice on web for example is to use a tag manager / dataLayer where product_id is either a variable that is set by the codebase or is alternately retrieved from a dataLayer that is defined on the page.
Question:
is there any code example how to implenent required logic for dynamic tracking impression and clicks of product attribute?
I also try to understand conceptually what kind of logic should we implement. Is it a code that parses the html page based on tag_id? ( sorry for dummy questions - it is just first time we are doing such implementation)
hi, Oleg
You can use GoogleTag to invoke tracker to send snowplow requests.
If you already have GT implementation on your pages you must go to Google Tag interface. Then you add new Tag (name it snowplow for example). Choose Custom HTML and PageView options .
Basically, follow this instructions.https://github.com/snowplow/snowplow/wiki/Integrating-javascript-tags-with-Google-Tag-Manager
Hi luliia.
We are using Google tag manager and I can successfully track page view and link clicks. What I don’t know how to track is impressions and clicks for a particular product and extracting the attributes related to the product.
Hi Oleg
you have to prepare the impression object on the site of your application and make it accessible in Google tag. So just put in some variable in global scope when rendering page.
for example, we put it in dataLayer object and call this in Google Tag.
You can simply output on your webpage
Hey, Oleg
So I just get you wrong, my bet But I still don’t get the actions you want to track. so you have a shop, and people click on the links that are product links, correct? Does the link add product to the cart or refer to the page with product? you want to track that the product was shown or bought?
You’ll need to push the values you’re interested in to the datalayer. There are a range of ways to send them to Snowplow but it sounds like the most fitting for your case will be to define a custom context and attach it to your event.
Yes lullia , you right. we want to track as detailed activity as possible, but it will be on the next steps. Meanwhile I try to track user_id , impression and clicks on the product. We have a web site and we show different products to different users on the web pages. All the examples are showing the hardcoded attributes tracking the impression and clicks. but I think it is not realistic. Suppose you have an ad space and each time there will be different advertisement with different attributes + different advertisement is showing to the different users , so I need a way to track the dynamic attributes :-).
Thanks Colm ,
I try to understand the approach, pushing to datalayer is always done from the web site part, right? It is not an extensions of SnowPlow js tracker code? Am I understand correct - there will be a code which will consolidate all the impressions in json format / json array and push it to data layer - it is for impressions.
For clicks there will be the code that will listen on events and extract the information from product (product in our case is url with different attributes ) and push it to data layer too?
Guys , @mike and @Iuliia
I am sure I am missing something but implementing the logic above it looks like to write additional js tracker? right? but it is not from snowplow side ( it is from website side)
I will explore the custom context, it looks promising for my case.