「TAmedia Tracking Guide EN」修訂間的差異

出自TAMedia
跳至導覽 跳至搜尋
行 10: 行 10:


Insert the following code '''within the <head> tag''', right '''above the </head> tag'''.   
Insert the following code '''within the <head> tag''', right '''above the </head> tag'''.   
If your page already includes this code, '''do not insert it again'''.
If your page already includes this code, '''no need to insert repeatedly.'''.


This script is TAMedia’s main tracking script and will automatically load the required tracking tool (''pixel.js'').
This script is TAMedia’s main tracking script and will automatically load the required tracking tool (''pixel.js'').

於 2025年7月25日 (五) 02:34 的修訂

TAMedia Tracking Integration Guide

This document explains how to integrate the tracking code provided by TAMedia into a website. It covers the base tracking code, category page view events, custom events, and important notes.


1. Base Tracking Code Integration

Placement

Insert the following code within the <head> tag, right above the </head> tag. If your page already includes this code, no need to insert repeatedly..

This script is TAMedia’s main tracking script and will automatically load the required tracking tool (pixel.js).

<script type="text/javascript">
(function(a,e,f,g,b,c,d){a.taq||(a[b]=a[b]||function(){a[b].q.push(arguments);a[b].tamTrackSendStatus&&a[b].tamTrackSendStatus()},a[b].q=a[b].q||[],c=e.createElement(f),d=e.getElementsByTagName(f)[0],c.async=1,c.src="https://adc.tamedia.com.tw/tr/"+g,d.parentNode.insertBefore(c,d))})(window,document,"script","pixel.js","taq");
</script>

2. Category Page View Event

When to Trigger

When a user visits a page, execute the following script to send a corresponding event.

This records a ViewContent event indicating that the user visited a specific page.

<script type="text/javascript">
  taq('track', '{your-campaign-id-goes-here}', 'ViewContent');
</script>

3. Custom Event Tracking

Purpose of Custom Events

When specific actions occur on your site (e.g., registration completed, a particular button clicked, a form successfully submitted), execute the following code to log the event.

{your-event-name-goes-here} is a custom event name (e.g., Customer00001) that must be pre-defined by TAMedia for each project.

This code logs a custom behavioral event. The event name must match the one configured in TAMedia’s system.

<script type="text/javascript">
  taq('trackCustom', '{your-campaign-id-goes-here}', '{your-event-name-goes-here}');
</script>

Notes

  • The identifier '{your-campaign-id-goes-here}' should be configured according to the specific project.
  • The taq object must be called after the base tracking script has been executed; otherwise, errors may occur.
  • To track multiple different events, you can reuse taq('trackCustom', ...) with different event names.
  • To confirm successful tracking, please contact the TAMedia technical team for reporting or verification support.

Contact Information For further integration support, please contact the TAMedia technical support team.