简体   繁体   中英

Sitecore Goals - Retrieve assigned item goals programmatically

I have built an MVC form which then uses javascript to post request to an API controller. Along with this request I am passing an item ID.

I'm looking to retrieve all of the goals assigned to a Sitecore item so I can retrieve the Goal ID and fire the goal request off programmatically.

Any help would be appreciated

Goals assigned to an item are stored in the __Tracking field.

Eg if you assign built in Newsletter Signup goal to an item, content of the tracking field will be:

<tracking><event id="{1779CC42-EF7A-4C58-BF19-FA85D30755C9}" name="Newsletter Signup" /></tracking>

where the {1779CC42-EF7A-4C58-BF19-FA85D30755C9} is the ID of the Newsletter Signup goal item.

You would need to parse the field to get the goal item ID.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM