Task 2. Create a "like" button event for my website
Tagging Requirements
- Event Name: click_like
- Trigger Type Name: click
- Trigger Definition: when a "like" button is clicked
- Variable Name & Definition:
1. page_url : The URL of the page where "like" button is clicked
2. page_title : The title of the page where "like" button is clicked
3. page_date : The date when the page content is published
How to configure a tag for the event "click_like"
Step 1. Install GTM snippet in your website
-Go to GTM and click the GTM-XXXXX
-Copy and paste the code as high in the <head> of the page as possible
Step 2. Variables > User-Defined Variables > New
-Create the variables defined above, Variable 2 and Variable 3
Step 3. Triggers>New>Click>All Elements>Some Clicks>Clicks Classes contains ico_postbtn ico_like
Step 4. Tags>New>Tag Configuration>Google Analytics:GA4 Event
-Add parameters by selecting the built-in variable "Page URL" for Variable 1(page_url), and then select the previously created Variable 2 and Variable 3
-Choose the trigger that was created in Step2
-Save and Submit
Step 5. Go to Google Analytics and verify if the event is set up correctly