Creating a TikTok Cookie Creator Tag
When a visitor clicks on your TikTok campaign, they arrive on your site with a ttclid cookie. From the GTM web container, you can save the information from that cookie for a month using a Cookie Creator tag. Easily create a custom cookie without JavaScript knowledge using the Tag Cookie Creator. Previously, creating a cookie required creating a custom HTML tag that required JavaScript knowledge.
- Open your GTM web container. Go to templates
- At Tag Templates, choose "View Gallery"
- Use the search function to find ‘Cookie Creator’. Add this tag template to your workspace.
- Go to variables
- Add a new User-Defined Variable
- Select URL in the list of variables
- Under "component type" select "query"
- Input "ttclid" as the query key
- Name the variable 'URL Query - ttclid' and save
- Navigate to triggers
- Create a new trigger
- For the trigger configuration type, choose ‘DOM Ready’.
- Select ‘Some events that trigger on ‘DOM Ready’’
- In the left dropdown menu, choose your created URL Query variable. In the middle dropdown menu, select ‘does not contain’. In the right input field, enter ‘undefined’
- Name the trigger "ttclid trigger" and save
- Navigate to tags
- Create a new tag. For the tag configuration, choose the Cookie Creator tag template.
- For ‘Cookie Name’, enter “cookie_ttclid”.
- For ‘Cookie Value’, select your URL Query variable.
- For ‘Expiration Month’, select ‘By month’.
- Under ‘Advanced Settings’, expand ‘Set Domain (optional)’, check the option, and enter “auto” in the input field.
- Under ‘Advanced Settings’, expand ‘Set Path (optional)’, check the option, and enter “/” in the input field.
- Geef deze tag de naam "cookie_ttclid" en sla de tag op.
Updated on: 16/08/2024
Thank you!