How do I get the value of a WFFM field as a tag an

2019-02-24 06:27发布

问题:

If I create a Web Forms For Marketers form with Analytics enabled I can choose to add each field as a tag to a Visitor. I can't see how to configure which tag they should be added to, or even what the tag is called by default (I'm assuming a tag with the field name is created).

I'd also like to know how to retrieve the tag data in a visit report (i.e. the one you'd get if you double clicked on a form submission in the Form Reports dialogue). I can see how to access plenty of inbuilt tags, but I can't find out how to fill these specifically from the form, and I cant see any fields in the report designer representing the field names I have.

回答1:

Question 1: How to set the name of the tag

If you set the "Tag" checkbox on the form field, the Item Name (=field name) of the form field is used as tag name. If you have database access, you can check the "VisitorTags" table on the analytics database to see which tags are written and how they are called.

Question 2: Retrieve Tag data in visit reports

In the VisitDetail report, the following inbuilt tags will be displayed if set:

  • Email
  • First Name
  • Second Name
  • Company
  • Organization
  • Full Name
  • StateProvince

Name your form fields accordingly and the values will be used in the report out of the box.

If you want to use custom tags in reports, have a look at the .mrt files in /sitecore/shell/Applications/Reports/. You will have to extend the report to use your own tags.

Example: Adding a custom tag to the VisitDetail report.

  1. Extend the SQL Query to fetch tags in the /sitecore/system/Settings/Analytics/Reports SQL Queries/Visits Visitor Tags item. Add the line

    , MAX(CASE WHEN [TagName] = 'SomeCustomTag' THEN [TagValue] ELSE NULL END) [SomeCustomTag]

  2. Extend the VisitDetail.mrt, add a column with value SomeCustomTag to the VisitorTags section just like the predefined tags.

  3. Use the value of your custom tag inside the report text by using {Visit.VisitorTagsRelation.SomeCustomTag}

I use a text editor to edit the .mrt files, but you can probably also do it in Reports Designer.