Customize Pixel & Postback Last update : May 21, 2020
Learn more about pixels and postback to exploit all benefice of AmaretAds tracking.
Introduction
In tracking documentation you can find some details to implement Pixels and Postback.
Implementation is easy and works for most of case, but sometimes you need to add more data in your pixel or your postback for any reason.
Additional Parameters
Some additional parameters are available to increase data you receive.
You can retrieve all this data, to know how, refer to "Manage Conversion" article.
Macros | Details |
---|---|
transaction_id | Needed for postback, this ID contains all session information. You can use it in all pixel to by pass cookies, etc. |
amount | Usefull for a sale. |
ref | A reference of the conversion provide by Advertiser system |
adv1 | Special key reserved for Advertiser to push some data. Usefull for conversion goals (Refer to "Manage Conversion Goal" article) |
adv2 | Special key reserved for Advertiser to push some data. Usefull for conversion goals (Refer to "Manage Conversion Goal" article) |
adv3 | Special key reserved for Advertiser to push some data. Usefull for conversion goals (Refer to "Manage Conversion Goal" article) |
adv4 | Special key reserved for Advertiser to push some data. Usefull for conversion goals (Refer to "Manage Conversion Goal" article) |
adv5 | Special key reserved for Advertiser to push some data. Usefull for conversion goals (Refer to "Manage Conversion Goal" article) |
Custom | Same as adv1, etc but you can use parameter you want. Usefull for conversion goals (Refer to "Manage Conversion Goal" article) |
Add parameters to Pixels & Postback
The way to add these additional parameters differs according to pixel type you use.
Javascript pixel
In Javascript (JS) pixel, it can be difficult to add parameter for none I.T. developer.
Take a look at JS pixel event line :
<script type="text/javascript"> AADS.action("lead","5d7a40ef1e251b607f693533", {});</script>
We can see script tag inform browser he needs to execute content as a javascript code.
In the content, we have :
- AADS : Name of library to use (Can differ than AADS, it's unique to every platform to work fine together)
- action() : The library's function to send event to AmaretAds.
- "lead" : Name of event enclosed by "
- "5d7a40ef1e251b607f693533" : Campaign ID enclosed by "
- {} : Here it's an object which can contains some additional parameters
To add parameter in "{}", you need to respect JSON standards.
Looks like {parameter:"value",parameter2:"value2"}
So for example, if you want to add the "ref" param in your pixel, you need to send that to your advertiser :
<script type="text/javascript"> AADS.action("lead","5d7a40ef1e251b607f693533", {ref:"{advertiser_ref}"});</script>
And your Advertiser need to replace {advertiser_ref} by is own value
Example :
<script type="text/javascript"> AADS.action("lead","5d7a40ef1e251b607f693533", {ref:"lead_543"});</script>
And you can do that for every parameters you want.
Iframe pixel
Iframe pixel looks like :
<iframe src="https://{your_tracking_domain}/tracking/iframe/lead/5d7a40ef1e251b607f693533" width="1" height="1" style="display:none"></iframe>
We can see iframe html tag and some attributes in it :
- src : Link to reach for this iframe. This is this part which will modify to add parameters
- width : We put 1 to have only 1 pixel width and hide this pixel
- height : We put 1 to have only 1 pixel height and hide this pixel
- style : This part concern CSS to apply to iframe. We put "display:none" to totally hide them
To add some parameters, we just need to add parameter to URL contain in src attribute.
For example, if we want Advertiser conversion reference, we add "ref" parameter.
<iframe src="https://{your_tracking_domain}/tracking/iframe/lead/5d7a40ef1e251b607f693533?ref={advertiser_ref}" width="1" height="1" style="display:none"></iframe>
Advertiser replace {advertiser_ref} by his own value and you got it in AmaretAds.
<iframe src="https://{your_tracking_domain}/tracking/iframe/lead/5d7a40ef1e251b607f693533?ref=lead-546" width="1" height="1" style="display:none"></iframe>
And you can do that for every parameters you want.
Image pixel
Image pixel looks like :
<img src="https://{your_tracking_domain}/tracking/action/img/lead/5d7a40ef1e251b607f693533" width="1" height="1" style="display:none" alt=" " />
We can see img html tag and some attributes in it :
- src : Link to reach for this iframe. This is this part which will modify to add parameters
- width : We put 1 to have only 1 pixel width and hide this pixel
- height : We put 1 to have only 1 pixel height and hide this pixel
- style : This part concern CSS to apply to iframe. We put "display:none" to totally hide them
To add some parameters, we just need to add parameter to URL contain in src attribute.
For example, if we want Advertiser conversion reference, we add "ref" parameter.
<img src="https://{your_tracking_domain}/tracking/action/img/lead/5d7a40ef1e251b607f693533?ref={advertiser_ref}" width="1" height="1" style="display:none" alt=" " />
Advertiser replace {advertiser_ref} by his own value and you got it in AmaretAds.
<img src="https://{your_tracking_domain}/tracking/action/img/lead/5d7a40ef1e251b607f693533?ref=lead-569" width="1" height="1" style="display:none" alt=" " />
And you can do that for every parameters you want.
Postback Pixel
This pixel is quite different from other because it's not a source code to put on website, but a URL called by Advertiser when he receives a conversion.
That's why we need to add transaction_id to the URL, because cookies and other data storage on user browser are not available
Postback url looks like :
https://{your_tracking_domain}/tracking/action/postback/lead/5d7a40ef1e251b607f693533?transaction_id={transaction_id}
To add some parameters, we just need to add parameter to URL.
For example, if we want Advertiser conversion reference, we add "ref" parameter.
https://{your_tracking_domain}/tracking/action/postback/lead/5d7a40ef1e251b607f693533?transaction_id={transaction_id}&ref={advertiser_ref}
Advertiser replace {advertiser_ref} by his own value and you got it in AmaretAds.
https://{your_tracking_domain}/tracking/action/postback/lead/5d7a40ef1e251b607f693533?transaction_id={transaction_id}&ref=lead-585
And you can do that for every parameters you want.
Warning
You should never remove transaction_id parameter for Postback, without it tracking system not works.