How to integrate DTM (Dynamic Tag Management) with AEM 6? - aem

I am a newbie to Adobe DTM (Dynamic Tag Management) and have not done any kind of training related to it. However, I have been given a requirement to integrate DTM with AEM 6. I Have some requirements related to Omniture where certain events on the website are tracked and that information needs to be sent to DTM. I have followed steps described on this blog (http://blogs.adobe.com/aemtutorials/2013/07/24/customize-the-client-context/) to customize the client context by creating a new session store and storing some sample data inside it. Now, next part is to retrieve this data into DTM which I am completely unaware on how to do. What is need to achieve in particular is to create a new data element as shown in the screenshot below and write some custom java script to access the data stored inside the client context (which is present in the session store) as explained in the blog mentioned.
I have no idea on how to integrate DTM with AEM instance and how to get hold of that data needed using the script. There is no info available on the internet regarding this, hence request you to help me in case anybody have worked on such a requirement earlier. Any help is highly appreciated

Step 1 - Set up DTM cloud services configuration in AEM. You may find cloud services config at /etc/cloudservices/dynamictagmanagement.html
Step 2 - Apply the above cloud config to the root of your website using the page property. This will insert the required JS scripts and JS object into the DOM. You could also do step (1) & (2) together by manually inserting header and footer code (from DTM) into the template.
Step 3 - Supply data to DTM JS object. This you could populate the data from server side or at client side using JS. You could leverage client context as well. JS APIs available to query client context.
PS: Am also a learner on this.
Helpful links:
http://blogs.adobe.com/experiencedelivers/experience-management/integrating-dtm-custom-aem6-page-template/
http://docs.adobe.com/docs/en/aem/6-0/administer/integration/marketing-cloud/dtm.html

You can use data elements with custom script like this:
e.g. dataElement authorizableId is custom script with content
return CQ_Analytics.ClientContext.get("/profile/authorizableId");
or
dataElement pageTitle
return CQ_Analytics.PageDataMgr.getProperty("title”);

This is how I implemented it. Please note that this implementation is for integrating with flat HTML files. Where we need to add the scripts in Head tag.
Pre-requisites:
1. We need to have login credentials for DTM website.
We need to have admin rights.
We need sc3.omniture site credentials. This is usually provided by Adobe team.
From Omniture console we need to generate the AppMeasurement.js file.
From AppMeasurement.js file we need to get important details like:
a. Tracking Server Name
b. s_account name
c. Visitor namespace
Connecting HTML files to DTM:
Login to https://dtm.adobe.com with admin credentials.
Click on Project dashboard
Click on Embed tab on top navigation.
Enable Host on Akamai.
Expand Header Code widget and copy the code.
Paste that code in the tag of your HTML.
Go back to DTM again. Expand Footer Code widget and copy the code.
Paste that code to the tag of your HTML.
Configuring DTM for Direct Call Rules:
1. Go to Rules tab from top navigation.
2. Click on Direct Call Rules from left navigation now.
Click on create rule.
Give it a name in the Name section.
Expand Conditions widget.
Pay close attention to the Conditions textbox. Direct Call Rules are fired using the _satelitte.track() method, and the text you enter in the Conditions textbox will be the argument you pass in this method. We entered “change-offer-submit”, so to fire this Direct Call Rule, we will use _satelitte.track(“change-offer-submit”) as you will see in the code below.
Now use the Adobe Analytics section to set up a custom link.
Below is the code that sets up our form and its validation. Notice the way the DTM _satelitte.track() is used. Each of the arguments passed in the _satelitte.track() method matches the Condition textbox in separate DTM rules.
HTML
<div class="outer-btn">
<input class="input-btn analyticsEvent" type="button" value="Submit" data-eventName="change-offer-submit">
</div>
JavaScript
<script>
jQuery('.analyticsEvent').on('click',function() {
window.console.log('Logged Event: ' + jQuery(this).attr('data-eventName'));
_satellite.track(jQuery(this).attr('data-eventName'));
location.href='./landingPage.html';
});
</script>

This has been superseded by a tool added to DTM in the June 2016 release, ContextHub was added in 6.1 as beta, in 6.2 it reached feature parity with ClientContext. It saves a lot of time building data layers as a lot of it will be there already .

Related

New Relic Data gives Wrong page views URL after New Relic script added via DTM

We have added a new relic script via DTM,
and New Relic Data shows wrong Page URL, it shows Page views as DTM URL, not actual page views,
this happening because DTM will compile all scripts and executes the script with in a iFrame. so New Relic is considering iframe url as request URL.
any one have idea how to fix this using DTM ?
Thanks
From the documentation, there are 4 types of Javascript / 3rd Party Tag containers.
It sounds like you chose Non-Sequential HTML container type, which appends a DTM hosted iframe to the page, with your code in it. To append your code to the parent page, you must change the tag type to either Sequential HTML, or convert the tag to pure javascript and use Sequential Javascript or Non-Sequential Javascript type.
Side note: make sure to read the document page I provided above to ensure the type you choose is compatible with when you have it set to output (top of page, bottom of page, dom ready, window load)

Redirect in Sharepoint 2010 Event Receiver

I'm looking at some code which has broken the saving of changes of a List item in SP2010. In the constructor of the Event Receiver the HttpContext is being stored as a local variable then in the ItemUpdating at the end a query parameter containing the return url is retrieved and passed the SPUtility.Redirect(...). This has the effect of canceling any changes that were made in the edit form. So following so scenarios I've found online I'm storing the HttpContext as a static class object and redirecting in the ItemUpdated event and edits are now persisted followed by a redirect to where we are expecting.
I have a concern though with storing a specific user's HttpContext as a static on a class which will potentially be hijacked if another user does the same action between the time user 1 sets the context initially and prior to the redirect. User 2 will overwrite the context and there are potential issues.
The only other option I can think of as a quick way out would be to store a static Dictionary where the key is the user id then remove the entry just prior to redirecting so as to not leave stray HttpContext instances leaking.
So looking at the accepted solution from here the first response by servy42 states The fact that it works for a few trivial test cases at first doesn't make it a viable solution. but doesn't suggest a viable solution.
There's another option best approach may be changing Save Button in ribbon such that when clicked, a ECMA script first save your Item, then redirect to other page, or open other page in dialog. suggested further down but is that the only other way to go?
I'm fairly new to SP and just trying to navigate through the wealth of wrong ways of doing things with my limited knowledge, whilst unfortunately being stuck with SP2010.
Any thoughts on how to go about this?
============
Edit: Further info as requested
So there are two sites one say called A which will have a sub site called B. A has a List and adding an item to that list triggers event receivers which creates sub site B and other related stuff. If I modify the B "item" from the SharePoint list of Bs then I don't need to redirect and returning to the list is fine. If I'm looking and a neatly rendered Gantt chart on A listing the Bs the if I edit B after clicking Save we need to come back to A. If I'm on B there's an edit button as well so I want to return to B after editing and clicking save.
So we have the source= appended when we go to the edit screen. From some reading I've done it seems SharePoint will pick that up and redirect. One of the fields on the edit page is the relative url beneath the A site and if that changes then the redirect url will no longer be valid and throw a 404 so we replace the old B sub path with the newly entered value. But we then need code to redirect to the new location.
I am not quite sure whether i understand your requirements correctly. But i will give it a try. Just a quick summary of what i understood (correct me if i am wrong...):
You have a Root Web in a site collection with a list
Each entry in that list corresponds to a subsite which will be created on List Item creation (ER) below the Root Web as a subsite
List items can be edited from both the List in the root web as well as from the subsite it maps to
On editing from the subsite you want to return to the subsite after saving
My approach would be this:
Follow the steps described in this article SP Dialog and List Forms
Open a dialog on the subsite that links to the edit form of the root web.
After saving the user finds himself already where he should be
Hope this helps... Cheers!
Edit: Just read the requirement about changing of url. Create a custom Edit Form which you enhance with some js that passes values back to the origin site -> Parameters in dialogs. You may then react accordingly in the javascript callback and redirect to the new url.

Can I read a value from one SharePoint web part into the the form for a list in another web part?

I'm not sure if it's possible to do what I'm hoping, but maybe I'll get lucky. It has to do with setting form fields in a SharePoint 2010 list, using InfoPath forms.
Basically, I have one list with requests from several vendors. Each vendors has their own requests page which is a Web Part Page with one web part: a list of submissions with a custom view applied that filters it only to them. This is a (clunky but functional) way to ensure each vendor only sees their own requests. To submit a new request, they click on the "Add Item" link at the bottom of the list web part. At this point, a customized InfoPath form pops up, and they add their request.
In the form, one of the fields is "Vendor". What I would like to achieve is to have the InfoPath form read something on the page which tells it which vendor's page it was called from and pre-select that vendor (I could then disable the control so they couldn't change it). I am happy to alter the calling page as needed, or to configure the InfoPath form (can you custom-configure GET or POST values or anything to define a field that way?).
Any help would be very appreciated.

Joomla Contact Form (from the ground up)

I'm looking to create a customized contact form in a Joomla 3 site I have created. I know how to write the php code for the form, but I'm unsure of where to place the code.
Ok, the form is located at http://www.theoscorner.com/contact-us. What you see there is only the design, and there is currently no script for the form to submit to. If I wanted to create a new php page for the form to submit to, what is the best method of doing this? For example:
Should I create a completely new php file where the template's index.php file sits, and use a module (instead of an article) to hold the form.
Should I create a new article page, and place my php script in that article?
Should I hard-code my form into a module, and place a php function at the end of the index.php page which gets called when the page is refreshed and the POST values are set.
I'm just looking for any type of guidance I can get right now. I don't want to use a third-party plugin, because I want a little more control than they allow. Thank you for your time.
Just use RS Forms or Contact Enhanced, they are both Joomla extensions available on extensions.joomla.org
There is no need to create your own MVC component.

Wizard based feature install in sharepoint 2007?

I have a feature that gets installed using a WSP package, when the feature is activated, I would like the following to happen:
The feature will contain a list definition.
When the feature gets activated by an end user (the user physically clicks the feature activation button in site features admin) - I would like a modal dialog to appear then ask the user to provide some additional details.
3.1 The additional details will be supplying a certain number of names. For example Mary, John, Peter. Form logistics I can handle.
Once the form is complete that information needs to somehow get back to the feature reciever, so that I can then take the base list definition, and use it as a template to create list instances for all the names supplied - so if user had supplied Mary and Peter, then 2 list instances will be created when this feature is activated.
Is any of this possible with MOSS 2007? Thank you
There's no way to "hijack" the feature activation process in sharepoint. The (crude) solution would be to create a feature that deploys an application page (aka layouts page) and the list template/definition. On the page there should be a bunch of textboxes and a submit button.
The feature should have a receiver attached to it that after activation redirects the user to your page using HttpContext.Current. After entering all relevant data in the page ( Mary, John, Peter, etc.) just create the lists based on the list template deployed earlier from code using something like:
SPListTemplate listTemplate = web.ListTemplates["YOURLISTTEMPLATENAME"];
web.Lists.Add(listName, description, listTemplate);
There is 1 caveat though, IMHO a dealbreaker even. this won't work when the feature is activated using stsadm, seeing as there is no HttpContext!!!