- Open Source
- APIs
- Advertising
- Blog
- Events
- Podcasts
- Apps
- Native
- Documentation
- Yahoo Native to Yahoo DSP API Migration Guide
- Sign In
- Language:
Installing Dot Tags¶
To access and retrieve your tag, simply visit the Dot section within your Native & Search account, or contact your account manager. Regardless of the Oath advertising application you use to retrieve your tag, your single Dot tag works for all your Yahoo search, native and display campaigns run through Native & Search or YAM+.
For details on accessing your Dot tag code, see Create a Conversion Rule or the DSP help page.
Your Dot tag will look similar to this:
<script type="text/javascript">(function(w,d,t,r,u){w[u]=w[u]||[];w[u].push({projectId:"XXXX",properties:{pixelId:"YYYY"}});var s=d.createElement(t);s.src=r;s.async=true;s.onload=s.onreadystatechange=function(){var y,rs=this.readyState,c=w[u];if(rs&&rs!="complete"&&rs!="loaded"){return}try{y=YAHOO.ywa.I13N.fireBeacon;w[u]=[];w[u].push=function(p){y([p])};y(c)}catch(e){}};var scr=d.getElementsByTagName(t)[0],par=scr.parentNode;par.insertBefore(s,scr)})(window,document,"script","https://s.yimg.com/wi/ytc.js","dotq"); </script>
Use the entire Dot tag code without modification. As a best practice, it is recommended that you copy and paste it into your whatever page template or content management system you use to tag all your website pages. While you may place the tag anywhere on the webpage, it is recommended to paste it in the <head> section.
If you only wish to send events for certain pages, you’ll need to place the Dot tag only on those pages. This is often done with the help of a tag management platform, such as Ensighten or Google Tag Manager.
The steps for creating Conversion Rules in Yahoo Native or DSP can be found at Create a Conversion Rule or the DSP help page.
Dot tag elements¶
The table below describes the important, required code elements of the Dot tag. You should not alter or change your Dot tag. Only the dotq
parameter of the Dot tag code may be changed, and only if it conflicts with other JavaScript used on your site.
Code |
Description |
---|---|
|
A key value used to key rules to the transmitted data points. You should not modify the value provided with the tag code. |
|
Provides additional validation of tag ownership. You should not modify the value provided with the tag code. |
|
This script, ytc.js, is loaded asynchronously so that rest of the page rendering is not blocked while fetching the tracking script. The asynchronous loading makes it possible to track all the events that can happen on a page even before the tracking script is fully loaded. |
|
A global array used for collecting event data. All the events that happen are queued in the global array and are processed by the tag script. |
Standard custom event parameters¶
Dot supports the collection of custom defined events through the use of a custom event script. This is additional JavaScript code placed on a page that works in combination with the Dot tag on that same page to pass custom-defined values for a set of reserved custom event parameters.
The custom event script supports four custom event parameters that capture and describe a user’s interaction with the website. None of the parameters are mandatory, but at least one of the parameters must be included in the custom event call.
Parameter |
Type |
Description |
---|---|---|
|
Event category |
The object you want to track. For example, button. |
|
Event action |
The type of interaction the user takes with the category object. For example, click. |
|
Event label |
Useful to label details about the event. For example, Product demo |
|
Event value |
Use it to track a numerical value associated with the goal. For example, a numeral 5. |
Capture a custom event on the page¶
When capturing an event to track, follow the template below:
<script type="application/javascript">
window.dotq = window.dotq || [];
window.dotq.push(
{
'projectId': '10001234567890',
'properties': {
'pixelId': '654321',
'qstrings': {
'et': 'custom',
'ec': 'event category',
'ea': 'event action',
'el': 'event label',
'ev': 'event value',
'gv': 'conversion value'
}
} } ); </script>
Note that et=custom
cannot be changed. Note also that for the ev
value, the enum value has to be passed as a string for the JavaScript value comparison.
The following example shows how you might use the custom event script to capture the event of a user adding a $249 electronics item to a shopping cart:
<script type="application/javascript">
window.dotq = window.dotq || [];
window.dotq.push(
{
'projectId': '10001234567890',
'properties': {
'pixelId': '654321',
'qstrings': {
'et': 'custom',
'ec': 'shopping',
'ea': 'add to cart',
'el': 'add to cart',
'ev': 'electronics',
'gv': '249.00'
}
} } ); </script>
Note the following:
The
et
parameter is required to be included and set to the value “custom”.The values of
projectID
andpixelID
must match those of the same parameters of the Dot tag included on the page.
To capture custom events on a user-initiated action:
A common use for the custom event script is to capture an event from an action a user takes after the page loads, like when submitting a form or starting a video.
Using the template above, you can capture events specific to an element of a webpage by including the push call inline.
<button onclick=" window.dotq = window.dotq || []; window.dotq.push( { 'projectId': '10001234567890', 'properties': { 'pixelId': '654321', 'qstrings': { 'et': 'custom', 'ec': 'event category', 'ea': 'event action', 'el': 'event label', 'ev': 'event value', 'gv': 'conversion value' } } } ); ">Submit</button>
Capture dynamic event values¶
When you use script to dynamically assign values to events, an additional conversion value parameter – gv
– is used. In Yahoo advertising applications you may choose to assign a constant conversion value to any conversion rule defined.
Alternatively, you can dynamically assign a conversion value to each standard and custom event collected through your Dot tag by populating the gv
parameter with JavaScript. This conversion value is a numeric monetary value that represents the revenue associated with the event, and is used to calculate the “revenue” of conversions in reports.
Parameter |
Type |
Description |
---|---|---|
|
Conversion value |
Used to pass a dynamic conversion value on a standard or custom event. This represents the goal’s revenue shown in reports. |
Assign a conversion value to a custom event
In the example snippets below, the function Revenue
is used to show possible business logic. The following are just examples. The actual logic and code for calculating a conversion value would be customized by the advertiser/developer.
<script> function Revenue (totalrev, revshare) {return totalrev * revshare;} // Function for computing the conversion value </script>
<script> window.dotq = window.dotq || [];window.dotq.push({ 'gv': Revenue(20, .5); }); // Compute and pass the conversion value </script>
Capture events related to your products¶
To track the product that the user has interacted with on your website, you need to use the ea
parameter to pass the type of user interaction and the parameter product_id
to pass the product id.
Parameter |
Type |
Description |
---|---|---|
|
Event action |
To track the user funnel for product retargeting use case, we accept the following values:
- ViewProduct;
- AddToCart;
- Purchase.
If the |
|
Used to pass the product id for the retargeting use case. |
In addition to the standard part of the Dot script on the webpage, you need to add the dotq script to pass the user action and the product id.
Below is an example of the dotq template.
<script type="application/javascript">
window.dotq = window.dotq || [];
window.dotq.push(
{
'projectId': '10001234567890', -- this value can be found on your Dot page in your account
'properties': {
'pixelId': '654321', -- this value can be found on your Dot page in your account
'qstrings': {
'et': 'custom',
'ea': 'insert the standard value', -- this represents the user interaction with your product
'product_id': 'product_id value',
}
} } ); </script>
For retargeting purposes, use one of the following standard strings to represent the user interaction with the product as the ea
value:
ViewProduct;
AddToCart;
Purchase.
Below is an example of a Dot pixel firing result from the advertiser product page:
https://sp.analytics.yahoo.com/spp.pl?a=XXXXXXXX&.yp=YYYYYYYYY&ea=ViewProduct&product_id=BAK1064
The value of XXXXXX and YYYYYYY should match your own Dot on the Dot view page.
For reseller and multiple website owners¶
If you’re a reseller or advertiser with multiple websites and you want to target users by website, you need to create a separate account per website. You also need to insert an additional parameter in the custom event field.
Below is an example of the dotq template.
<script type="application/javascript">
window.dotq = window.dotq || [];
window.dotq.push(
{
'projectId': '10000', //this value can be found on your Dot page in your account
'properties': {
'pixelId': '654321', //this value can be found on your Dot page in your account
'qstrings': {
'et': 'custom',
'advertiser_id': 'insert the Native & Search account id here',
'ea': 'insert the standard value', //this represents the user interaction with your product
'product_id': 'product_id value',
}
} } ); </script>