viewCategory
awoo Pixel Event for category page loaded. 🗂️
✨ Introduction
The viewCategory is designed to trace when users explore specific categories on your website. This event captures profound insights into user preferences, category interests, and the overall efficacy of your category structures. The landscape of viewCategory may serve as a reference to refine your content strategies.
⭐ JS Snippet of viewCategory
Below is the JavaScript snippet for the viewCategory event. To correctly trace a user's engagement with various category pages, you should embed it into every category page.
In the provided snippet, there is one parameter (pt) required to be set dynamically when the event is triggered. The value of this parameter is used to indicate the category displayed on the category page. Notice that the format and value should be consistent with the corresponding fields specified in your datafeed. Check the following table for more details.
<script type="text/javascript">
awpx('param', {
pt: '{name of the category}'
});
awpx('event', 'viewCategory');
</script>
<script type="text/javascript">
awpx('param', {
pt: 'Men > Shoes'
});
awpx('event', 'viewCategory');
</script>
Parameter | Definition | Type | Corresponding Datafeed Field |
---|---|---|---|
pt | name of the category | string | Product Category |
🌟 Triggering Condition
The viewCategory event should be triggered when a category page is loaded.
Beware that awoo Pixel's initialization should be executed before viewCategory is triggered. Hence, you may need to add a "defer" attribute to those two scripts to have them executed in the order they appear in the webpage's HTML. Placing viewCategory snippet just before the closing </body>
tag helps preserve the execution order of the scripts as well. Check the following code block for sample implementations:
<script type="text/javascript" defer>
// awoo Pixel's initialization
</script>
<script type="text/javascript" defer>
awpx('param', {
pt: 'Men > Shoes'
});
awpx('event', 'viewCategory');
</script>
<html>
<body>
<!-- Your HTML content goes here -->
<script type="text/javascript">
awpx('param', {
pt: 'Men > Shoes'
});
awpx('event', 'viewCategory');
</script>
</body>
</html>
There should be only one awoo Pixel's initializationMultiple awoo Pixel's initialization on a single webpage will cause error, so make sure you only have it loaded once per page.
🌠 Implement with GTM
For your better comprehension, below are the sample screenshots from GTM (Google Tag Manager) for the implementation of viewCategory event. The JavaScript snippet is inserted as a custom HTML tag, with the triggering condition set to Page View - Page URL contains 'category?cid='. In this particular case, the value for pt is dynamically extracted from the category page's URL.
You should modify the actual implementation based on your website. Beware that awoo Pixel's initialization should be loaded before any triggered event.

a sample implementation of viewCategory as a custom HTML on GTM

a sample triggering condition for viewCategory event on GTM
Edited by: Justin Sung
Updated 4 months ago