Adobe DTM - Analytics/Omniture query string missing parameters - adobe-analytics

I've searched for days looking into this issue but have yet to come up with something. We are migrating our analytics code over to DTM. We are using our own Library hosted at DTM. Everything works great except for some missing data collection parameters in the query string only when using the Adobe Analytics tool to assign variables.
Let me explain. When I use custom code in DTM in a rule to call analytics I get exactly the same query string parameters in the request that we were getting before.
var str = 'string';
s.linkTrackVars = 'prop61,eVar61';
s.linkTrackEvents = 'none';
s.prop61 = str;
s.eVar61 = str;
s.tl(this, 'o', str);
This works fine.
If I try to set eVar61 and prop61 with the Adobe Analytics tool inside a rule, five parameters are no longer in the query string. Specifically 'pev1', 'pid', 'pidt', 'oid' and 'ot'. Is there a way to get DTM to set those parameters or am I just to use custom code for all our rules?
Thanks

Those are clickmap query string parameters. Click on the gear icon to edit the global Analytics tool, and under Link Tracking, make sure 'Enable Clickmap' is checked. Alternatively, you can set s.trackInlineStats=true in your code, which effectively achieves the same effect.
If you ever see missing query string parameters in the future, you can determine what variables to define using the Data Collection Query Parameters in the Marketing Cloud documentation.

Related

=importxml, Website to Google Sheets - getting #N/A every time

Website Link
https://redacted
xml options I have tried so far
<span aria-labelledby="amount">722</span>
//*[#id="amount"]/h3/span[2]
/html/body/div[3]/main/div/span/div/div/div[2]/div/div/div[2]/div/div[2]/div[3]/div/div/div/div[2]/div[1]/h3/span[2]
None working
Trying to =importxml from here # a value of "722" this is value on 5/5/22 anyway.
Unfortunately, it seems that your expected value cannot be directly retrieved using the XPath. Because the value is put to the HTML using Javascript and IMPORTXML cannot analyze the result of Javascript. But, fortunately, it seems that your expected value is included in the HTML as the JSON data. So, in this answer, I would like to retrieve the value from the JSON data.
Pattern 1:
In this pattern, IMPORTXML and REGEXEXTRACT are used.
=ARRAYFORMULA(REGEXEXTRACT(IMPORTXML(A1,"//script[#data-component-name='GetOfferWrapper']"),"defaultEstimatedValue"":(.+?)}"))
The URL https://www.gazelle.com/iphone/iphone-13-pro-max/other/iphone-13-pro-max-1tb-other/498082-gpid is put in the cell "A1".
When this formula is used, the following result is obtained.
Pattern 2:
In this pattern, a custom function created by Google Apps Script is used. When the value is retrieved from JSON data, Google Apps Script is useful. When you use this script, please copy and paste the following script to the script editor of Spreadsheet and save the script. And, please put a custom function of =SAMPLE("https://www.gazelle.com/iphone/iphone-13-pro-max/other/iphone-13-pro-max-1tb-other/498082-gpid") to a cell.
function SAMPLE(url) {
const res = UrlFetchApp.fetch(url).getContentText();
const data = res.match(/<script.+data-component-name="GetOfferWrapper".+?>([\w\s\S]+?)<\/script>/);
if (!data || data.length == 0) return "No data";
const obj = JSON.parse(data[1]);
return obj.initState.defaultEstimatedValue;
}
The URL https://www.gazelle.com/iphone/iphone-13-pro-max/other/iphone-13-pro-max-1tb-other/498082-gpid is put in the cell "A1".
When this formula is used, the value of 722 is retrieved.
Note:
The formula and custom function can be used for the current HTML. So, when the specification of HTML is changed, those might not be able to be used. Please be careful about this.
References:
IMPORTXML
REGEXEXTRACT
Custom Functions in Google Sheets
fetch(url)
JSON.parse()
you will need to find another site with intel you attempting to scrape. the #N/A error is the result of google sheets not supporting the import of JavaScript elements. you can always check for compatibility by disabling JS in site settings and only what's left can be usually scrapped. in this case its nothing:

How do I find the Conversion Action ID for use in the Google Ads API?

I'm using the latest (v7) Google Ads API to upload offline conversions for Google Ads, using the Python Client Library. This is the standard code I'm using:
import os
from google.ads.googleads.client import GoogleAdsClient
client = GoogleAdsClient.load_from_env(version='v7')
def process_adwords_conversion(
conversion_date_time,
gclid,
conversion_action_id,
conversion_value
):
conversion_date_time = convert_datetime(conversion_date_time)
customer_id = os.environ['GOOGLE_ADS_LOGIN_CUSTOMER_ID']
click_conversion = client.get_type("ClickConversion")
conversion_action_service = client.get_service("ConversionActionService")
click_conversion.conversion_action = (
conversion_action_service.conversion_action_path(
customer_id, conversion_action_id
)
)
click_conversion.gclid = gclid
click_conversion.conversion_value = float(conversion_value)
click_conversion.conversion_date_time = conversion_date_time
click_conversion.currency_code = "USD"
conversion_upload_service = client.get_service("ConversionUploadService")
request = client.get_type("UploadClickConversionsRequest")
request.customer_id = customer_id
request.conversions = [click_conversion]
request.partial_failure = True
conversion_upload_response = (
conversion_upload_service.upload_click_conversions(
request=request,
)
)
uploaded_click_conversion = conversion_upload_response.results[0]
print(conversion_upload_response)
print(
f"Uploaded conversion that occurred at "
f'"{uploaded_click_conversion.conversion_date_time}" from '
f'Google Click ID "{uploaded_click_conversion.gclid}" '
f'to "{uploaded_click_conversion.conversion_action}"'
)
return False
I believe the code is fine, but I'm having problems locating the conversion_action_id value to use. In the Google Ads UI there's a screen listing the different Conversion Actions, with no sign of an ID anywhere. You can click on the name and get more details, but still no ID:
The conversion action detail screen in Google Ads UI
I've tried the following:
Using the ocid, ctId, euid, __u, uscid, __c, subid URL parameters from this detail page as the conversion_action_id. That always gives an error:
partial_failure_error {
code: 3
message: "This customer does not have an import conversion action that matches the conversion action provided., at conversions[0].conversion_action"
details {
type_url: "type.googleapis.com/google.ads.googleads.v7.errors.GoogleAdsFailure"
value: "\n\305\001\n\003\370\006\t\022dThis customer does not have an import conversion action that matches the conversion action provided.\0320*.customers/9603123598/conversionActions/6095821\"&\022\017\n\013conversions\030\000\022\023\n\021conversion_action"
}
}
Using the standard Google answer:
https://support.google.com/google-ads/thread/1449693/where-can-we-find-google-ads-conversion-ids?hl=en
Google suggests creating a new Conversion Action and obtaining the ID in the process. Unfortunately their instructions don't correspond to the current UI version, at least for me. The sequence I follow is:
Click the + icon on the Conversion Actions page
Select "Import" as the kind of conversion I want
Select "Other data sources or CRMs" then "Track conversions from clicks"
Click "Create and Continue"
I then get the screen:
Screen following Conversion Action creation
The recommended answer says:
The conversion action is now created and you are ready to set up the tag to add it to your website. You have three options and the recommended answer in this thread is discussing the Google Tag Manager option, which is the only option that uses the Conversion ID and Conversion Label. If you do not click on the Google Tag Manager option you will not be presented with the Conversion ID and Conversion Label.
Not so! What three options? The first "Learn more" link mentions the Google Tag Manager, but in the context of collecting the GCLID, which I already have. The "three options" mentioned in the official answer have gone. Clicking "done" simply takes me back to the Conversion Actions listing.
Using the REST API
I've tried authenticating and interrogating the endpoint:
https://googleads.googleapis.com/v7/customers/9603123598/conversionActions/
hoping that would give a list of conversion actions, but it doesn't. It just gives a 404.
Does anybody know a way of getting the Conversion Action ID, either from the UI or programmatically (via client library, REST or some other method)?
Thanks!
If you're using Python, you can list your conversions via next snippet:
ads: GoogleAdsServiceClient = client.get_service('GoogleAdsService')
pages = ads.search(query="SELECT conversion_action.id, conversion_action.name FROM conversion_action", customer_id='YOUR_MCC_ID')
for page in pages:
print(page.conversion_action)
You can also open conversion action in UI and locate &ctId=, that's the conversion action id.
I found this post with the solution how to get the Conversion Action ID:
(…) I found out that conversionActionId can be found also in Google
Ads panel. When you go to conversion action details, in URL there is
parameter "ctId=123456789" which represent conversion action id.
By the way, I tried something similar and it's still not working, but with this Conversion Action ID I get a different "Partial Failure" message, at least.
At least in Google Ads API (REST) v10,
it works if field conversionAction is set with value:
'customers/{customerId}/conversionActions/{ctId}'
customerId - without hyphens
ctId - conversion action id, as mentioned in above comments,
taken from GET parameters in Google Ads panel when specific conversion is opened.
Can also be found programmatically with API method.

Need to remove numbers with a javascript code step in Zapier

I am not a developer but have used Google search and trial and error test scenarios with Zapier for the last few days and have given up on figuring this out myself. I need help!
I'm using the Run JavaScript code step in Zapier and provided the following details to Input Data.
It says: What input data should we provide to your code (as strings) via an object set to a variable named inputData?
I'm using "street" with a street address example "1402 Spring Garden Rd"
What is the code to use that regardless of the street address provided all the numbers and first space are removed so that the results is "Spring Garden Rd"
Thank you in advance!
var street = inputData;
var streetNoNumbers = inputData.replace(/[0-9]/g, '');
return streetNoNumbers
The error message I'm getting is
TypeError: inputData.replace is not a function
I've learned that strings are immutable and a new string can be made from manipulating another string but doing this in zapier seems to require a function and creating another var with the calculation generates a ... is not a function.
I've tried to write a function but can't get the output or return to show the proper results either.
I can do the following successfully,
var street = inputData
return street
1402 Spring Garden Road
I want to include the code that manipulates street to produce the following:
Spring Garden Road
David here, from the Zapier Platform team. Great question!
The key understanding you're missing is that inputData is a js object with a street property. Before your code is run, we set it up like so:
const inputData = {street: '1402 Spring Garden Rd'}
Since inputData is an object, it doesn't have a replace method (the error you're seeing). Instead, perform your operation on .street and return that.
Try the following:
// need to return an object, not just a string
return {streetNoNumbers: inputData.replace(/[0-9]/g, '')}
If you want to learn more, I recommend our simple examples: https://zapier.com/help/code/#simple-email-extraction

How do I fire a list var from a DTM direct call?

I am trying to fire values into a list var in Adobe Analytics from a DTM direct call but can't seem to get any values to appear.
In my custom code in the direct call rule I have
cTS = _satellite.getVar('conversionTypeShown');
s.list1 = cTS;
and the Data Element conversionTypeShown is getting information from the digitalData layer on the page (which is updated just before the direct call)
if ((digitalData.searchResults !== undefined) && (digitalData.searchResults !== ""))
{
return digitalData.otherJobsType + digitalData.searchResults;
}
I know that these values are being populated correctly because I am firing an eVar with the same data in it (within the same rule) which is coming through OK into Adobe Analytics. But I am not getting any values for the list var?
Does a direct call not allo me to use custom code in this manner?
Any help would be gratefully received.
Owen.
Many thanks to Owen. I didn't find this hint in the Adobe documentation.
Finally my code looks like this and works.
s.linkTrackVars="list1,list2";
s.list1=_satellite.getVar("FieldsSubmitted");
s.list2=_satellite.getVar("FieldsAborted");

Difference between Msxml2.DOMDocument and Msxml2.XMLHTTP

What is the difference between:
Msxml2.DOMDocument
Msxml2.XMLHTTP
? And of course, the other question is which one will work best for my purpose as described below?
The context is this - I have code that makes many calls to retrieve web pages. I am looking for the most efficient object for this task. For example, something like this:
Dim oXmlHttp : Set oXmlHttp = CreateObject("MSXML2.XMLHTTP")
oXmlHttp.Open "GET", sUri, False
oXmlHttp.Send
If Err Then
getWebPage = "ERROR - could not get the source text of the webpage."
Exit Function
End If
sResponse = oXmlHttp.responseBody
This seems to work the same way if I create an object using:
Dim oXmlHttp : Set oXmlHttp = CreateObject("MSXML2.XMLHTTP")
Can anyone explain or point me to a reference that clearly outlines the differences (and intended usages) for each of those?
If you want to learn more about MSXML, these links may help:
http://msdn.microsoft.com/en-us/library/aa468547.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms766487(v=vs.85).aspx
In short, XMLHTTP is used to retrieve information, while DOMDocument is used to structure and parse it.
This page explains it better: http://msdn.microsoft.com/en-us/library/windows/desktop/ms760218(v=vs.85).aspx
DOMDocument "Represents the top node of the XML DOM tree." while XMLHTTP "Provides client-side protocol support for communication with HTTP servers."

Resources