You can track, measure and validate impressions, clicks and events on your creatives after bidding in real-time via the client-side TrafficGuard Ad tag.

Overview

The Ad tag is implemented alongside your creative tag. When the tag is triggered, Javascript executes an analysis of the clients' device or browser. Then, uses API to collect and send creative related data to TrafficGuard server for ad fraud detection.

Is the JS Ad Tag for you?

Use the Ad Tag option when you are an advertiser who wants to gain visibility into fraudulent activities on your ads.

Installing Ad Tag

To install the tag, copy the following code and paste it in your ad server.


💡 Tip

When copy-pasting the tag below, you will need to specify parameters such as {custom_params}, {property_id} with your own values.


JS Ad Tag Template

<!-- TrafficGuard Integration -->
<script>
var dataTrafficGuard = dataTrafficGuard || [];
dataTrafficGuard.push(['property', '{property-id}']);
dataTrafficGuard.push(['event','impression']);
(function() {
var tg = document.createElement('script'); tg.type = 'text/javascript'; tg.async = true;tg.src = 'https://tgtag.io/tgad.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(tg, s);
})();
</script>
<noscript><img src="https://p.tgtag.io/impression?property_id={property-id}no_script=1" width="1" height="1" border="0"/></noscript>
<!-- TrafficGuard Integration End-->

ID

Parameter

Description

1

property_id

This property can be found in your TrafficGuard Portal

2

event_name

Define initial event that will be sent upon initialisation
Values: impression, pageview

JS Tag Minimal Integration

<!-- TrafficGuard Integration -->
<script>
var dataTrafficGuard = dataTrafficGuard || [];
dataTrafficGuard.push(['property', '{property-id}']);
dataTrafficGuard.push(['event','impression']);
(function() {
var tg = document.createElement('script'); tg.type = 'text/javascript'; tg.async = true;tg.src = 'https://tgtag.io/tgad.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(tg, s);
})();
</script>
<noscript><img src="https://p.tgtag.io/impression?property_id={property-id}&no_script=1" width="1" height="1" border="0"/></noscript>
<!-- TrafficGuard Integration End-->

Adding custom parameters to Ad Tag

This table provides a list of custom API parameters which can be used in data-trafficguard

ID

API Parameter

Description

1

agency_id

ID of the agency

2

app_id

App package name as it appears in the store

3

campaign_id

Campaign name or ID

4

creative_id

Identifier of the ad creative

5

creative_set_id

Identifier of the ad creative set

6

creative_type

Type of ad creative (display, video)

7

gdpr

GDPR Consent passing

8

gdpr_consent

GDPR Consent passing - Encodes the consented-to purposes and vendor consent string, as obtained from the CMP JS API or OpenRTB.

9

gdpr_pd

GDPR Consent passing - for generic URL parameters, gdpr_pd=0 indicates none of them contain personal data (from the perspective of the callee). For "defined" URL parameters, their definition should define whether they include personal data.

10

placement_id

Identifier of the ad placement

11

section_id

Identifier of section of the ad placement

12

siteid

ID of the site or mobile app where the user was engaged

13

sub_param_1

Custom Parameter 1

14

sub_param_2

Custom Parameter 2

15

sub_param_3

Custom Parameter 3

16

sub_param_4

Custom Parameter 4

17

sub_param_5

Custom Parameter 5

18

sub_source_id

Identifier of the sub-source or sub-publisher

19

validation

Enabled viewability monitoring service
Value: true

20

source_id

Partner id

21

goal_id

This can be used when event_name=goal, to send the measurement platform's event ID or name

Example of adding custom params to tag data-trafficguard

This example will initialize javascript tag, finds HTML tag with data-trafficguard tag, read parameters and

  1. Send impression event

  2. Due to parameter added: 'validation':true viewability measurement service will be initialized

<!-- TrafficGuard Integration -->
<script>
var dataTrafficGuard = dataTrafficGuard || [];
dataTrafficGuard.push(['property', '{property-id}']);
dataTrafficGuard.push(['event','impression','{"source_id":"partner_id_example"}']);
(function() {
var tg = document.createElement('script'); tg.type = 'text/javascript'; tg.async = true;tg.src = 'https://tgtag.io/tgad.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(tg, s);
})();
</script>
<noscript><img src="https://p.tgtag.io/impression?property_id={property-id}&source_id=example_partner&no_script=1" width="1" height="1" border="0"/></noscript>
<!-- TrafficGuard Integration End-->

Response codes

We return an HTTP 2xx response for all valid tag requests.

JSON

{
"status_code":200,
"message":"success",
"execution_time_ms":23,
"results":{
"transaction_status":"success"
}
}


Bad requests (e.g., a request containing a malformed or corrupt payload) will return HTTP 4xx. You should NOT retry the request. Instead, you should stop and correct any errors in your HTTP request.

JSON

{
"status_code":400,
"message":"error",
"execution_time_ms":6,
"errors":[
"The property_id parameter is not valid."
]
}

Rate limits

There is no hard rate limit on the TrafficGuard Ad tag. However, we ask you to let us know if you need to measure at a rate exceeding 500 requests per second.

Caching and sampling

We strongly advise against caching responses in your application or site or sampling events to measure. TrafficGuard does its best work with all the data points of user interaction and as TrafficGuard is determining the difference between real and none real users in real-time you may introduce false positives from cached data.

Privacy by design

TrafficGuard fully supports privacy policies as specified by buyers and sellers of advertising. In particular, TrafficGuard supports do-not-track and the ability to pass user preferences from sellers to buyers inline with the IAB GDPR framework.

Did this answer your question?