GTM dataLayer.push() not working - pdf

I am tracking PDF download using custom metric. I have written following code
<script>
dataLayer.push({'DLPdfdownload': 1});
</script>
DLPdfdownload is datalayer variable name that I have created in GTM V2.
Script is executing but the problem is that value for PDF download doesn't increment even if I download particular PDF many time. Value in the custom metric remains 1 only it doesn't increment with the download.
What changes do i need to make in script so that value get increment every time I download a PDF

Your question is somewhat incomplete. I'm going to assume from context that you are using Google Analytics with GTM and that you have already created a custom metric in your property settings.
The custom metric will only be incremented if you send it along with a Google Analytics hit. So you need to look up the numeric index for your metric in the property settings. Then you need to set up an Analytics tag that is triggeres when the pdf is downloaded, e.g. by a link click trigger. In that tag you expand the "custom metrics" section, enter the numeric index of your dimension in the index field and your dataLayer variable in the value field.
If that is what you are already doing, or if I have misunderstood your problem, you need to amend your question with more information.

Try to push some 'event' key's value in dataLayer with custom metric data and use custom event with this value as a trigger. Might be that you send data to GA before your custom metric value is pushed to dataLayer.

Related

Shopify - is it possible to change the preview of a product with a inputbox?

Which ways are possible to edit the live preview of the product page in Shopify with Inputboxes next to it?
Let's say the product is a poster, and i want to add a custom text on it.
When typing into the inputbox the text changes in real time on the product.
Can this be implemented in the shopify code with the basic version of shopify?
Or does this necessarily needs an app?
ADDITIONALLY:
Let me go a bit deeper. I have a code that can generate a QR code.
Now i want that the QR code to be previewed in the product. Now position and color of the QR code is different from any product. Would that need an app?
Yes you can to an extent.
First the ground rules:
You can't modify the product from the front-end and update the content or media in the back-end - this would be a huge security hole
The changes applied to the product will be visible only to the user who changed them
The solution is to use Javascript and update the content of the front-end. If you like to store the changes for that specific user you can save them as cookie or localstorage.
If you like to share this change to other people you will need to add a custom parameter in the URL of the page and generate the content from it and share that url.
Each one of these steps will require some custom Javascript that will affect only the user in question, if you like to modify the product in the back-end directly you will need some kind of an app for this.
On my mind it can be done if the dynamic text is applied over product image.
Detailed code would be too long to write here but here are the steps:
Add an input to your product form to add a custom property (https://community.shopify.com/c/Shopify-Design/Product-pages-Get-customization-information-for-products/td-p/616503)
Write a Javascript function to get input value in real time
Use this value to display it in a div in product image container
Position this div in CSS as absolute and style it as you wish
While image container position should be set as relative in CSS
HTH

Get blog post custom field in template head - Sitefinity

I need to set several meta tag values in my page head to values set in blog post custom fields.
How do I access the blog item viewmodel from the head?
I've created a separate MVC view snippet for my custom head and referenced it in my template's layout, that much works.
Tried
I grab some of the same custom field values inside my blog template via references like Model.Item.Fields.MyFieldName.Fields.Title.
Adding this same line to the head template throws a
System.Web.HttpCompileException with little useful information attached. I somewhat expected this, as I suspect that viewmodel for the blog post only exists in the context of the blog widget.
Ends up that I need to rebuild after every change to the head cshtml file or I get this error. Seeing as this is about a four-minute process with Sitefinity (15 seconds to build, 3:45 to do whatever Sitefinity does for about four minutes), this is a gruelingly horrid thing to have to do.
However the Model is null at this level.
Also tried
Per the ever-helpful and highly knowledgeable #Veselin Vasilev, I looked into passing the data up via MetaDataFields. I didn't see these options in my admin section for the widget. To clarify, I'm using the built-in "Blog posts" widget with a customized view file.
But if it's possible to do this, it gives me hope that there's a way to pass more data up, even if it's going to take some work.
EDIT: Sitefinity v.10.2 and above:
There is an easier way to achieve what you are trying - in Page edit mode, in the Blog Posts widget click Edit and then Advanced. Then you should see a MetaDataFields button. Click it and you should see several meta data related fields.
In the MetaTitle field put the name of your custom field and save.
Also, from the docs:
If you leave MetaTitle field empty, Sitefinity CMS adds takes its value from the Title field of the static content item or from the identifier field of a dynamic content item. Otherwise, the tag is populated with the contents of the field that you have entered in MetaTitle field.
More details here:
https://docs.sitefinity.com/configure-meta-title-and-meta-description-on-widget-level
Sitefinity 10.1 and below:
Check this article
Basically, in your view you get a reference to the Page object and then update its Header with the meta data you need.

How can be changed a documenttype layout in Hippo CMS

I created a hippo documenttype using a one column layout. For rendering purposes I would like to reorganize the given items into a two-columns layout.
However, no option is available to do this change, at least not by using the latest hippo cms community version.
I have already searched in google and found following information, saying that it may be possible to change the layout by using the console, but no information about how:
http://hippo.2275632.n2.nabble.com/How-to-delete-or-rename-document-types-td7579269.html
I would appreciate any hints about it.
AFAIK there is no documentation on how to do this: this is not very complicated but this is a tedious process. If you still can - for instance your document type is not used yet - I would advise to simply drop it and recreate the content type. That being said, here is how it works:
look into your project namespace in the console: the path is something like this: /hippo:namespaces/YOURPROJECT/document-type/editor:templates/_default_/root
the root nodes defines the layout. Check out the plugin.class: for a one column this will be org.hippoecm.frontend.service.render.ListViewPlugin and for a 2 column layout the plugin.class will be org.hippoecm.frontend.editor.layout.TwoColumn
for every field in your document type (that's the tedious part) you will need to define if the field placed on the right or the left.
this is configured on the node with the name of the field path, as a property wicket.id that for instance have the value ${cluster.id}.left.item. This means the item will be placed on the left side.
Your best bet is to create a 2 column example document type and look carefully at its configuration and replicate the changes in your existing field.
Have you tried the instructions on the link below ?
http://www.onehippo.org/library/concepts/document-types/custom-editor-layout.html

Google Tag Manager and dataLayer interraction

I use GoogleTagManager script and dataLayer object. I read in documentation that dataLayer object has to be filled above the GTM script.
But I need to add a product detail when the user chooses the product and it happens after the GTM script is loaded.
If I use dataLayer.push(chosenObject) will this action call the Google Tag Manager script? Will it work?
Yes, you can push variables to the dataLayer at any time, the "trick" is in how to access the data from the dataLayer in your tags (plus if you declare you dataLayer above the GTM code you do not call "push" - you declare it as a variable so you can push later).
It's necessary to declare the data in the dataLayer if you want to use it as soon as the page loads - the standard pageview trigger will run as soon as the GTM code has loaded (i.e. before the page has finished loading), so obviously GTM can only access data that preceeded it in the code.
Triggering tags in GTM takes an event (do not confuse with Google Analytics events or Javascript events, event in GTM is just a reserved variable name).
A few events are produced by GTM implicitly - the pageload-event, DOM ready, click and submit events.
If at some later point you want to trigger an element to respond to a value you pushed to the dataLayer you need a custom event:
dataLayer.push({
'event':'i_pushed_a_value',
'payload' : 'this is my data'
})
(please not that data comes in key->value pairs).
Now you can have a trigger that fires on the event i_pushed_a_value, and you can use a custom variable of the type dataLayer (enter the key, in this case payload, as key in the variable configuration) that holds your data.

Retrieve the configuration parameter in adobe livecycle

I have set a configuration parameter containing a path in adobe livecycle process. I want that path to be reflected in a fragment source file property of an xdp. Is there a way to retrieve the value of configuration parameter in adobe live cycle designer? will it be done using javascript in designer ?
If I understand your question correctly, here is what you are doing:
In a LiveCycle process orchestration, you are reading in a configuration parameter.
You have a form with a fragment embedded in it and you would like to read in a the configuration parameter.
Your form is probably saved on the LiveCycle server.
Since the process orchestrations are called at runtime, you can't call a variable/configuration parameter during design time. If you want to read it in at runtime, I would suggest the following approach:
Add a setValue component that injects the runtime parameter into a hidden field ( if you just need to read the value and perform some calculation based on it) or a visible field.
Test your rendered from to ensure that the variable value is injected correctly into the template.
Do let me know if you have any other questions.
Thanks,
Armaghan.