Mailchimp merge tags in Google Analytics measurement protocol hit URLs - email

I'm trying to use the Google Analytics measurement protocol to send a hit to GA when someone opens an email from Mailchimp. The documentation I'm following is here: https://www.lunametrics.com/blog/2013/06/17/email-tracking-google-analytics/
I'd like to use Mailchimp merge tags to insert dynamic values for some of the parameters. For example:
client id --> be cid=*|UNIQID|*
event label --> el=*|MC:SUBJECT|*
An example of pixel code placed at the end of an email:
img
src="http://www.google-analytics.com/collect?v=1&tid=UA-XXXX-Y&cid=*|UNIQID|*&t=event&ec=Email&ea=open&el=*|MC:SUBJECT|*&cm=email&cs=*|LIST:NAME|*&cn=*|CAMPAIGN_UID|*&cc=teaser2&cm1=1"
In GA, none of the merge tag values are showing up. The client ID is "*|UNIQID|*" instead of a dynamically inserted value and the event label is "(not set)".

Related

Acumatica / Myob Advanced: add an email field

On Myob Advanced (Acumatica), we would like to add a salespersons email address to the Salespersons page (AR205000). This is so that we can then add this field to the Sales Order email template, allowing us to CC the salesperson in every time their customer places an order.
Ive tried to implement this extra field, "Salespersons Email Address"; but I am having some issues.
It will only allow me to save 25 characters within the text box? How come I'm unable to add more than 25 characters?
Email fields that come with the software all have the code of px:PXMailEdit. However, i cant seem to be able to create a MailEdit field, only a px:PXTextEdit field? Why is this?
Thanks for your help. If this doesnt make sense or you need further info LMK.
Currently, Layout Editor does not support PXMailEdit control. Please find below the steps to add a custom email field on the Salespersons screen:
For the SalesPerson DAC, ceate a new field of the string type with length set to 255 (this is the length defined in the PXDBEmailAttribute used on all email fields in Acumatica/MYOB Advanced):
Replace generated attributes with the attributes below, save your changes and publish customization:
[PXDBEmail]
[PXUIField(DisplayName="Email Address")]
Open the Salespersons screen in Layout Editor and add TextEdit control for the custom field declared on step 1, then save your changes:
Select Edit Project Items from the File menu and change control type from PX.Web.UI.PXTextEdit to PX.Web.UI.PXMailEdit in the XML changeset generated for the Salespersons screen, save your changes and publish customization one more time:
This is how custom email field should look like on the Salespersons screen after you complete the steps above:
Using Salesperson's email in Automation Notifications:
If you set up custom Email Address field from the Salespersons screen as CC address in Sales Order notification:
the system will automatically include Email Address from the Default Salesperson in notification message:
Using Salesperson's email in Notification Templates:
This might seem a litle confusing, but the Sales Person node available for selection on the Notification Templates screen represents an Employee linked with a Salesperson (see screenshot below for details):
With SalesOrderNotification's CC field set to ((SalesPerson.SalesPersonID.UsrEmailAddress)), the system should automatically include Email Address from the Default Salesperson in the generated email:

Setting Date as a prop in Adobe DTM

I'm trying to use Adobe DTM to pass the date to a prop variable but haven't had much success. The final output should be a prop report in Adobe that'll provide me traffic data for specific dates (5/11/16, 6/15/15 etc). The ultimate goal for setting the dates as a prop is to be able to classify a range of dates based on various business needs.
Could anyone point me in the right direction for getting this done? I am assuming I'll have to add a line of code in the s.code file that'll define s.prop5 = ...
Thanks
Based on your comments, it sounds like you are just looking to pop something with the current date stamp with "MM-DD-YYYY" format.
As Gigazelle mentioned, you can create a Data Element to return the value, and then reference it for setting your prop. However, throwing a data layer into the mix may be overkill for you, depending on your needs/limitations.
Data layers are meant for exposing data that DTM can't feasibly/reliably automate on its own via built-in features or hosting an autonomous js snippet.
The only reason you might want to consider having your site push it to a data layer, is if you want to generate the date via server-side coding to ensure the date is generated within the same timezone setting for all visitors. If you generate it client-side, it will be generated according to the visitor's browser/system settings. Since visitors are from all over the world in different timezones, the data may not be as consistent (even if you add additional code to change the timezone offset, it still may not be 100% based on browser version/security settings, or visitors who alter their browser/system date/timezone settings).
So, if you want to ensure the best accuracy, then I suggest you output the value via server-side code, and put into a data layer. How you do that depends on your server and what language you have at your disposal for your web pages being served up. Here is a very basic example using PHP:
<script>
var dataLayer = {
currentDate : '<?php echo date('m-d-Y'); ?>'
}
</script>
This will have the server generate the date stamp and output a js object called dataLayer with a property currentDate you can reference. You can create a Data Element as Type "JS Object" and for Path, put dataLayer.currentDate, and then reference your Data Element elsewhere (see below).
If that's too much trouble for you or if you want to keep it pure client-side/DTM and are okay with the potentially lower consistency...
Within DTM, go to Rules > Data Elements, and click Create New Data Element.
Name it "currentDate" (no quotes).
For Type, choose "Custom Script", and click Open Editor, and add the following:
var t=new Date(),d,m,y;
d=t.getDate();
d=d<10?'0'+d:d;
m=t.getMonth()+1;
m=m<10?'0'+m:m;
y=t.getFullYear();
return m+'-'+d+'-'+y;
Click Save and Close and Save Data Element.
Now you can reference the data element to pop prop5. How you do it depends on how you've setup Adobe Analytics within DTM. For example, if you set it up as a tool and only want it to pop on initial page view, you can open your AA tool config, go to the Global Variables dropdown, and set prop5 there. You reference it as %currentDate%
You can do the same %currentDate% syntax in a Page Load Rule or other rule or any other place that uses DTM's built-in fields.
Alternatively, if you need to reference it within javascript code (e.g. if you are setting prop5 within s.doPlugins or some other Custom Script box, you can reference the data element like this:
s.prop5 = _satellite.getVar('currentDate');
Set a JS variable on your site (such as within a data layer) that outputs the date in the format you wish to collect it in. Something like var d = Date();
In DTM, go to Rules > Data Elements and create a data element that maps to the JS variable you created on your site
If you want prop5 to be defined on every page, click the gear icon and map prop5 to your data element name by using %DataElementName% (whatever you named your data element in step 2, wrapped in percent signs). If you don't want it defined on every page, go to Rules and create a page load rule, event based rule or direct call rule depending on when you want the variable to trigger. Under the Adobe Analytics section of the rule, map prop5 to %DataElementName% .
This will allow you to collect dates as values, which can then be used in classifications.

How to generate Confluence page based on tabular data

I have some tabular data about users. I would like to have a Confluence page generated based on it. But I don't want to show the data as it is but instead have a nice table made of it.
For example data includes user identifier. But on the page I would like to have it used for few things. For example make an anchor to the user entry/row, show the identifier in a column and generate link (in another column) to some other tools where the identifier is an argument in URL.
This goes in obvious direction of data vs. presentation separation with all its benefits.
Now the problem is that I don't know how to do that while I feel that it should be somehow possible with all that Confluence offers.
There are various reporting macros. But the problem is how to get the initial tabular data. I tried using Excel (or CSV) attachment. But I failed to extract data from it (otherwise than just showing a simple table based on it).
Any advice? I'm using Confluence 5.4.
I have asked about it previously on Atlassian Answers in question Reporting on spreadsheet data from attachment but there are no answers so far and I think there will be none. While I think Stack Overflow is more popular so I hope that maybe here someone will have any advices.
For the 'display table information on the page' part: This could be achieved with a user macro. The CSV macro and HTML macro can be used to pull data in from an attachment or other locations to display on a wiki page.
There are other ways to display this kind of data. This be done with information extracted from a database using the SQL macro. Confluence can read in from its own database or from external databases.
For example, let's say you wanted to list all pages in a space with hyperlinks using the key page information to edit, view, delete the target page. The information being extracted in this example is in the Confluence table.
{sql-query:dataSource=wiki|output=wiki}
SELECT
'['||B.spacename||'|'||B.spacekey||':]' "Space Name",
'['||A.parentid ||'|///pages/viewpage.action?pageId='||A.parentid||']' "Page Parent",
'['||A.contentid||'|///pages/viewpage.action?pageId='||A.contentid||']' "Page Id",
'['||A.title ||'|///viewpage.action?pageId='||A.contentid||']' "Page Title",
'[View Page |///pages/viewpage.action?pageId='||A.contentid||']' "View Page",
'[Edit Page |///pages/editpage.action?pageId='||A.contentid||']' "Edit Page",
'[Delete Page |///pages/removepage.action?pageId='||A.contentid||']' "Delete Page"
FROM wiki.CONTENT A, SPACES B
WHERE B.SPACEKEY = 'sp' -- Put the spacekey here
AND B.SPACEID = A.SPACEID
AND A.TITLE like '%this%' -- Optionally, only return results for pages with the word 'this' in them
-- AND A.CONTENTID = 125999877 -- optionally, only return results for a single page by id
ORDER BY A.TITLE
{sql-query}
Once you have the content on the page it is possible to post-render wiki content using a JavaScript via the html macro.
{html}
<script type="text/javascript">
AJS.$(document).ready(function() {
AJS.$('#tableid').find('tr > td').contents().html('Hello world'); // or whatever to find and change the html or text
});
</script>
{html}
I presume your Confluence is version 4 or later. The default editor is WISIWYG, but you can also enable Source Editor (read Confluence doc on how to do this).
You can create source of a page in external editor and then copy/paste it in to Confluence Source Editor (or use Confluence REST API if you need to import multiple files).
Create a page with sample table, then view source of this page. Copy/paste elements of this page to your tabular data. Use search and replace patterns to insert tags in right places.
For example, if you have CSV file:
- replace commas with </th><th>
- put <tr><th> at the start of each line
- put </th><tr> at the end of each line
This should create nice table in Confluence.

GTM Reduce number of tags

GTM up and running, main UA tag in place along with a ClickListener tag.
To reduce the number of macros, i use dataLayer variable Macros for event category, action, label, value & interaction, so they can be used for many rules and tags.
So i want to collect data from one link/button (Add to Fav), i add a rule to listen for the click using {{event}} equals gtm.click and {{Event Label}} equals Add_to_Fav (the label i push to the DL via onclick.
All good so far, but i need to create another UA tag (Track Type - event) that fires on the rule made previously. And this is my question, using this method seems to create many tags. If i have another 20 links that i want to collect data from, do i need to keep creating tags like this. Surely, this will affect page load speed with many tags firing on all pages.
Hope thats all clear.
If you need to retrieve the link text to use it as an event label you do not need many many event tracking tags, that would be horribly verbose. Instead you can use a custom javascript macro - the cool thing about them being that you can use existing macros inside your custom function.
If you create a click listener or link click listener this will create a few macros - one of them is {{element}}, which is the DOM element that received a click.
Now you create a macro of the type "custom java script", which must contain an anonymous function with a return value.
The barebones version of a function that retrieves the text of a clicked link would be
function() {
var el = {{element}};
return el.innerText;
}
(actually you do not need the variable assigment, you could use {{element}}.innerText directly).
You name the macro e.g. Linktext and use the macro {{Linktext}} in your single event tracking tag where it will dynamically be set to the value of the text of the clicked link (although you might want to check cross browser support for innerText, or maybe use innerHTML instead which serves in you use case probably the same purpose).

Multi-step form with user-input and external web-service

I am building a Booking model in Rails 3.2.3 where a user steps through several form-screens of choices. If the form exactly mirrored the underlying model I know I could use a gem (e.g. Wicked gem) to build a multi-step form. The issue I am having is that on one of the form-screens there are multiple options for the user and within each of those options there are multiple options coming from an external web-service. In other words, on step 2 of the multi-step process, the form presents the user with many options of Rates from our database and for each Rate we have multiple additional options from the web-service. So a user would need to choose one of the options from the web-service (radio buttons) and then make a selection of their Rate of choice. This is then repeated multiple times on this page (although the user can only choose one radio-button option from the web-service and one Rate).
Where I am unsure of best practice is that I can display the multiple options from the web-service as radio buttons but there is a Hash of values associated with each of those options and hence with each of those radio buttons.
So, the question is, should I be attempting to pass that Hash as a param to the next step of the form process or should I be making that into an object and passing that or something else entirely!
I know this is a long explanation but I feel it's a critical point in the design of this workflow and I want to get it right.
Many thanks in advance,
J.
EDIT
Thinking it through again, the initial problem is how to represent a series of radio buttons when each radio button represents many values as opposed to say an id (in this instance each radio button represents a hash of values from the external web-service). Should the hash be made into an object and this passed instead - something along those lines?
I figured this out. On inspecting the "hash" coming back from the external web-service, I noticed that date fields were not in quotes, e.g.
:departs=>Wed, 21 Aug 2013 10:40:00 +0000
whereas all the other fields were in quotes. This made me a little suspicious. So in the end I used to_json on the returned hash:
response_hash_from_webservice = data.to_json
In the form I then used:
JSON.parse(response_hash_from_webservice).each do |nested_item|
# Access elements like so
... nested_item['company_name'] etc ...
end
However I needed to post this nested_item through to a next step of the form (as a radio button) and it only worked by again using to_json.
<%= radio_button_tag 'nested_item', nested_item.to_json %>
I could then post this value or put it in the session and on the following form page use:
require 'json'
hash = JSON.parse session[:nested_item]
And then access the values as normal:
<%= nested_item['company_name'] %>