Use macros to pass information to Floodlight tags

You can pass conversion-based information to publisher tags with the following macros:

  • Use %s to collect the Campaign Manager site ID from the user cookie. (Site IDs link to specific publisher tags.)

    Parsing the publisher site ID from the user's cookie is a straightforward procedure that inserts the site ID where the %s macro is used (for example, the publisher tag field or the default tag field).

  • Use %p to collect information assigned to the Floodlight tag in the advertiser's page.

    The %p macro captures any substring within the request path, as long as it matches the pattern defined in its parameters. In addition, after the macro identifies its match, it passes that information through the redirect URL.

  • Append the %n macro to generate a random number, if needed.

Example

<iframe src="http://1234567.fls.doubleclick.net/ activityi;src=1234567;type=expglob;cat=kb123;u1=[PRODUCT_NAME];u2=[PRODUCT_ID];qty=1;cost=[Revenue];x=[Dsearch_prod_id];y=[Dsearch_prod_name];z=[Dsearch_price];da1=[Dsearch_quantity];ord=[OrderID]?"width="1" height="1" frameborder="0" style="display:none" ></iframe>

When the publisher's product name placeholder only accepts a value of 1 to 5, but the advertiser has implemented text strings instead, you will need to convert these values.

Something like the following script could execute the proper data conversion:

<SCRIPT LANGUAGE="JavaScript">
var pub_cost="%pcost=!;";
var pub_prod="%pu1=!;";
var pub_prod_id="%pu2=!;";
var pub_ord_id="%pord=!?";
var item=0;
switch (pub_prod){
case "hotel_room": item=1;
break;
case "flight": item=2;
break;
case "car_rental": item=3;
break;
case "time_share": item=4;
break;
case "package": item=5;
break;
default : item=0;
}
myImage=new Image();
myImage.src='https://www.publisher.com/u?CAMPAIGNID=1234567&ORDERID='+pub_ord+'&TYPE=89101112&ITEM='+item+'&AMOUNT='+pub_cost+'&QUANTITY=1&CURRENCY=GBP&METHOD=IMG';
</script>

In this example, you must convert the pub_cost variable to an integer between 1 and 5 before passing it on to the publisher tag.

To manipulate what the Floodlight tag passes, use a switch statement to map ad server values to the values set by the publisher.

You may also have to manipulate the the cost and quantity values so they do not break the parsing of the conversion on the publisher's side. 

Floodlight activity tags can contain a variety of variables that the advertiser's website populates dynamically when the Floodlight activity code is served. In some cases, you might want to include the same variables and values in the dynamic tags (default or publisher tags) that you've added to your Floodlight activity. To do so, you can use the %p pattern match macro.

Use %p to pass variables and values to dynamic tags

The %p macro captures any substring within a request path, then passes it in a redirect URL. The macro uses the following format:

%p[start_key_string]![end_character]

Replace [start_key_string] with the key part of the key-value whose value you want to pass into the default or publisher tag. For example, if you're passing the value of the ord= key-value, the [start_key_string] is ord=. The [end_character] is typically a semicolon (;) to separate multiple key-values, or a question mark (?) to end the string. For example, the complete key-value to pass ord= would be order=%pord=!?.

Tag example

In this example, you're using a 1x1-pixel GIF tag for tracking purposes, and including the tag in your default tags.

Placeholder tag:

Here's the 1x1-pixel tag, with placeholders for the information you want to include:

<img src="https://www.mywebsite.com?price=[price]&category=[category]&order=[orderID]" height="1" width="1" />

Notice that you're creating new key-values. The new key can be anything you like (in this case, price, category, and order).

Tag with macros:

Using the %p macro, you replace the placeholders as follows:

<img src="https://www.mywebsite.com?price=%pcost=!;&category=%pu1=!;&order=%pord=!?" height="1" width="1" />

For each key-value, the value is %p, then the key part of the original key-value from the Floodlight tag, then an equals sign (=) and exclamation point (!). You can use this structure to import any key-value from the original Floodlight tag.

If it's the last key-value in the tag, end with a question mark (?). For other key-values, end with a semicolon (;). Notice that the original ampersand (&) separator remains in place. That's necessary because the question mark and semicolons are removed when the macros are expanded.

Tag with expanded macros:

When the macros are expanded, the new value is the original value of the key you referenced with the %p macro.

<img src="https://www.mywebsite.com?price=19.95&category=books&order=BUY12834988?" height="1" width="1" />

Possible issues

Issues that may arise when passing information from a Floodlight tag to a fourth-party publisher tag include:

  • Parameters enforce data types (string, integer, and so on)

  • Different number formats expected (number of decimcal places, maximum digit limit, and so on)

  • Different indicators for same parameters across multiple tags (for Floodlight, product=name_of_product; for publisher tag, product=integer_from_1_to_5, and so on)

Please take care when using parameters in tags. The terms of your Google Marketing Platform contract prohibit passing any information to us that we could use or recognize as personally identifiable information (PII). If you enter certain values into a field in a Google Marketing Platform product, you may see a warning that reminds you that you must not use parameters to pass data that we would recognize as PII. Parameter friendly names that trigger this warning include, for example, email and username. Note that it is okay to use these friendly names if your purpose is not to collect information that Google Marketing Platform could use or recognize as PII. (For example, a custom variable with the friendly name email and the value weekly is fine, but passing a user’s email address is not.) If we see any cause for concern, we may contact you to confirm that you are not using parameters in a way that is prohibited.

 

Learn more about our best practices to avoid sending PII.

Was this article helpful?
How can we improve it?