Prints tracking data used by Google Analytics Enhanced Ecommerce in connection with product links and purchase buttons.
Kuvaus
The tag requires JavaScript files to function, which are added in the theme using the {SupportScripts} tag.
The tag prints an HTML attribute to which a JSON object with the data read by Enhanced Ecommerce is added.
The tag is used in link elements directing to a product page. Below you can see a usage example for the tag:
<a href="{ProductUrl}" {ProductLinkData}>{ProductName}</a>If you use product list tags' default outputs in your theme (instead of your own helper files), there is no need for you to add the {ProductLinkData} tag separately.
If your online store uses a custom-made purchase form – implemented without using the {ProductBuy} tag – add the following markup to the purchase form:
<form action="/cart/" enctype="multipart/form-data" method="post" class="BuyForm" {ProductLinkData(type: 'add_to_cart', event: 'submit')}> ... </form>Näkyvyys
Toimii näkyvyydessä: tuote
Attribuutit
event:Defines an event in connection with which an action is registered in the tracking service.
Allowed values:- 'click': Triggers tracking when a link is clicked (default value).
- 'submit': Triggers tracking when a form is sent.
type:Defines the action that should be tracked.
Allowed values:
- 'click_product': Tracks product link clicks (default value).
- 'add_to_cart': Tracks the actions in which products are added to the shopping cart.
If a product has variations, downloadable files or customizations, the attribute's value is set to 'click_product' automatically.
before/after:With the
beforeandafterattributes, you can define content that is output before or after the content produced by the tag.Allowed values: text that may contain HTML and Interface markup.
E.g.
before:'<p>This markup appears before the tag's own content.</p>'.after:'<p>This appears after the tag's own content.</p>'
If the tag does not produce any content, the content of the
beforeandafterattributes will also not be displayed.escape:Adds an escape character before quotation marks in the output. The attribute makes it easier to process the tag-produced content when using JavaScript.
Allowed values: true/false. The default value is false.
or:Defines alternative content that is displayed if the tag itself does not produce any content.
Allowed values: text that may contain HTML and Interface markup.
E.g.
or:'Content not found.'
