AdRoll’s SmartPixel allows for powerful URL-based segmentation, but there are instances where code might be needed to segment your audience.
Internal Site Page Clicks
If you have two links that direct visitors to the same internal page, such as different buttons on different landing pages, you can segment the traffic from the different buttons.
Clicks on links that direct visitors to internal pages on your site can be tracked by adding internal campaign tracking codes.
Most marketers are familiar with the practice of adding external campaign tracking codes to their external marketing links for tracking purposes. Google Analytics has a standard which use uses utm tracking codes for tracking. You can view the AdRoll article on adding external tracking codes for more information.
Internal links can also be tracked and segmented with tracking codes, but instead of using utm codes, advertisers should add distinct tracking code parameters to internal links they want to segment.
Edit your internal links to add a query parameter such as link_tracking=<link identifier> to the end of the destination URL. Make sure the destination URL has the AdRoll pixel code.
<a id="link1" href="http://example.com/path/page?link_tracking=link1">Link #1</a> <a id="link2" href="http://example.com/path/page?link_tracking=link2">Link #2</a>
Both these links have the same destination and user experience but can be segmented separately in AdRoll.
In-page javascript and AJAX
You can track links that don’t prompt the browser to change it’s location, by executing additional javascript.
Include the AdRoll pixel on the page.
Setup and name a segment within the AdRoll dashboard
When the link is clicked, executing the following javascript:
__adroll.record_user({"adroll_segments": "segment_name"});
Be sure to populate the segment name in the code with the corresponding value you setup in the AdRoll dashboard.
External destination link clicks
To track pages that direct visitors to destination pages where you cannot place AdRoll pixel code, you have to use javascript to track the click as the click happens. This is accomplished by intercepting the click, tracking the action, adding a small 250 millisecond delay to the user to allow tracking and then forwarding the user to their destination.
javascript version:
<script type="text/javascript"> function trackExternalLink(link, segment) { try { __adroll.record_user({"adroll_segments": segment}); setTimeout('document.location = "' + link.href + '"', 250) } catch(err){} } </script> <a id="free_ticket" href="http://www.google.com/" onClick="trackExternalLink(this, 'example_segment_name');return false;">example anchor text</a>
jQuery version:
<script type="text/javascript"> // Requires jQuery 1.7 or higher (use .live if using a lower version) $("#example_segment_name").on('click',function(e){ try { __adroll.record_user({"adroll_segments": $(this).attr(id)}); var newtab = (e.metaKey || e.ctrlKey) ? true : false; if (!newtab) { e.preventDefault(); setTimeout('document.location = "' + $(this).attr("href") + '"', 250); } } catch (err) {} }); </script> <a id="example_segment_name" href="http://www.example.com/page">example anchor text</a>
Enhanced Conversion Tracking
__adroll.record_user({"adroll_segments": "example_segment_name", "adroll_conversion_value_in_dollars": "16.44", "order_id": "12345"});
The post Guide to Segmenting Clicks with AdRoll appeared first on AdRoll Support.