I recently implemented an Audience Manager integration in a Web 8 DD4T (.NET) project. I was scratching my head for a long time about an error message that didn’t seem to make sense:
Unable to determine the current Publication. Please make sure the Ambient Data Framework is running, or configure a DefaultPublicationId in the cd_audience_manager_conf.xml configuration file
All I wanted to do was retrieve and update Audience Manager Contact details, which are not related to publications, so it didn’t make any sense why I was getting this message. Some digging around in log files showed me that Audience Manager was executing
GetPageMetaByUrl using a claim in the ADF containing the current request URL (
taf:request:full_url) – then I started to realise what was going on…
In my MVC web application we remove the file extension (and sometimes filename) from the URLs, so /news/cat-bites-dog.html becomes /news/cat-bites-dog and /news/index.html becomes /news/. As these URLs do not correspond to actual pages in the CMS, Audience Manager cannot get the page meta, and then cannot proceed with processing the request.
Why is this? you ask… Well I don’t have a really good answer to that, suffice to say that it uses the page metadata to determine a publication Id, and then uses this publication id to determine the Audience Manager service endpoint to connect to (Peter Kjaer explains it in this Trex answer).
I guess this is a point for improvement in the next release, but in the meantime, all you need to know is that to get this working, you just need to override the
taf:request:full_url claim in the ADF with a valid page URL – we used the homepage (as this will never be changed/unpublished).
The following code snippet shows how you can do this (the _configuration and _publicationResolver are DD4T-based objects to get the homepage URL – you can replace them with whatever you need, or simply hardcode a known URL).