
If you want to fire an external pixel during for engagement events such as outbound clicks or form submissions, you can do so by using the `bind` command
The bind
command will allow you to run a JavaScript function every time an engagement event triggers within your website. AnyTrack will fire the original event and also call the bind function so you can trigger other external events.
Command Interface
The bind
command take 2 arguments:
- The event name you want to catch (ie.
OutboundClick
,FormSubmit
, etc..) - A callback function that will called every time this event occurred
For example:
<script>
AnyTrack('bind', 'OutboundClick', function(e) {
// your custom code here...
});
</script>
Access Event Details
The first argument of the callback function will contain some basic details of the event triggered such as the click id, brand name and other parameters.
Here is a full list of the event properties:
Property Name | Example Value | Description |
target |
- | The target HTML element (if provided) |
eventId |
abc1234567 |
The event id been used for deduplication |
clickId |
9GFPT7brs8ussWWmxBvUVKQ7N |
The event click id |
clientId |
8usseFfNL2 |
The user client id |
eventName |
OutboundClick |
The current event name |
eventValue |
899.9 |
The event value |
currency |
EUR |
The currency code provided, if omitted the default property currency will apply |
trackingGroup |
shopify |
The integration group name that trigger the event |
link |
- | The link details object with properties such as url and id |
brandName |
iPhone 12 Pro |
The brand name, if provided |
transactionId |
abc1234567 |
The transaction id |
shippingPrice |
19.9 |
Optional shipping price |
taxPrice |
89.52 |
Optional tax price |
items |
- | An array of provided items |
Full Example
Assuming you got the following pixel image to integrate on your website:
<img src="https://www.3rdparty.com/pixeltrack.pl?c=CLICK_ID" width="1" height="1 />
You can use the following code to trigger this pixel every time there is a OutboundClick event on your website:
<script>
AnyTrack('bind', 'OutboundClick', function(e) {
AnyTrack('postback', 'https://www.3rdparty.com/pixeltrack.pl?c=' + e.clickId);
});
</script>
Learn more about the postback command.
Comments
0 comments
Please sign in to leave a comment.