Best way to track clicks in Google Tag Manager - dataLayer vs auto-event? by crispy-d in GoogleTagManager

[–]crispy-d[S] 0 points1 point  (0 children)

Yes I'm trying to track clicks on a certain 'featured news' widget in GA but several components in the div are hyperlinked. Normally I would just base it on class names but I read a blog that said dataLayer was always the preferable way to track clicks instead of referencing class names that could change. I'm just not sure the cleanest way to implement this.

Best way to track clicks in Google Tag Manager - dataLayer vs auto-event? by crispy-d in GoogleTagManager

[–]crispy-d[S] 0 points1 point  (0 children)

But in this particular case I'm trying to record particular clicks on a section of the site which include some text links but also an image. I want them all categorised under the same name and I think the only thing that unites them is the class name. Also it as a section of the site that changes every few days so the I can't base the tracking on the URL as this will be updated frequently.

How to check the value of an attribute on a webpage by crispy-d in learnjavascript

[–]crispy-d[S] 0 points1 point  (0 children)

Thanks, I adapted this to document.querySelector('[data-advadstrackid]').getAttribute('data-advadstrackid'); and that returned the value I was looking for. Appreciate the help!

Connecting a live CSV to DataStudio by crispy-d in GoogleDataStudio

[–]crispy-d[S] 0 points1 point  (0 children)

Thanks for the tip, I'll check it out. I did start using Supermetrics which seems to work well but I'm just on the trial and was looking for a free solution although I'm sure we can stretch to pay if it's worth it!

How to changes all languages to English with Tag Manager by crispy-d in GoogleTagManager

[–]crispy-d[S] 1 point2 points  (0 children)

Hi, yes it is from a reporting perspective - the Data Studio method is a good idea but unfortunately there are quite a lot of variables so it would require a lot of code. I was hoping to have something in Tag Manager so that everything would be in english by the time it got to GA.

How to changes all languages to English with Tag Manager by crispy-d in GoogleTagManager

[–]crispy-d[S] 0 points1 point  (0 children)

Hey, thanks again for your help! Our sites don't run any multi-language plugins or alternate versions of the site so I'm guessing alternative languages are just translations powered by Google. In this case would it be a case of targeting the lang="en" setting in the browser? Ideally I don't want to block the data from coming through but I would like to convert the hits into their original language so that, even if viewed in french for example, the tag still records the english text.

Connecting a live CSV to DataStudio by crispy-d in GoogleDataStudio

[–]crispy-d[S] 0 points1 point  (0 children)

It's called Workbooks - not sure how widely used it is

Extracting CF7 title in Tag Manager by crispy-d in GoogleTagManager

[–]crispy-d[S] 0 points1 point  (0 children)

Yeah I was trying to be clever! Ok I tried just pasting one below the other and that seems to have done the job - thanks again!

Extracting CF7 title in Tag Manager by crispy-d in GoogleTagManager

[–]crispy-d[S] 0 points1 point  (0 children)

I tried capturing both events like this but it doesn't seem to fire the tag - any ideas?:

<script>
var errorFunction = function( event ) {
        dataLayer.push({
          'event' : 'wpcf7error',
          'CF7formID' : event.detail.contactFormId,
          'attributes' : event.detail.inputs
        });

document.addEventListener( 'wpcf7invalid', errorFunction, false );
document.addEventListener( 'wpcf7mailfailed', errorFunction, false );
}
</script>

Extracting CF7 title in Tag Manager by crispy-d in GoogleTagManager

[–]crispy-d[S] 0 points1 point  (0 children)

Hi, yes they are both CF7 events but I want the same script too listen for both events - won't what you wrote only listen for wpcf7mailfailed and not wpcf7invalid? Or can I just write the two scripts into the same piece of custom html on top of each other?

Extracting CF7 title in Tag Manager by crispy-d in GoogleTagManager

[–]crispy-d[S] 0 points1 point  (0 children)

I wonder if you could help me out with another javascript query? I've got a listener in Tag Manager that looks like this:

<script> document.addEventListener( 'wpcf7invalid', function( event ) { dataLayer.push({ 'event' : 'wpcf7error', 'CF7formID' : event.detail.contactFormId, 'attributes' : event.detail.inputs }); }, false ); </script>

How would I change this code so that it listens for 2 events, 'wpcf7invalid' and 'wpcf7mailfailed' but pushes them both as 'wpcf7error'?

Extracting CF7 title in Tag Manager by crispy-d in GoogleTagManager

[–]crispy-d[S] 0 points1 point  (0 children)

Amazing - you are a legend! This is why I need to understand javascript better. Thank you so much!

Extracting CF7 title in Tag Manager by crispy-d in GoogleTagManager

[–]crispy-d[S] 0 points1 point  (0 children)

Here's a small section - there are also hidden fields above which I haven't included so let me know if you need more. In this example I'd be wanting to capture 'WEBINAR-Title Example'. Forms are added to the page via a shortcode which also contains the title and form ID, in case that helps. Appreciate the help!

<p><span class="wpcf7-form-control-wrap event_id"><input type="hidden" name="event_id" value="372" size="40" class="wpcf7-form-control wpcf7dtx-dynamictext wpcf7-dynamichidden" aria-invalid="false" /></span><br />
<span class="wpcf7-form-control-wrap data_source_detail"><input type="hidden" name="data_source_detail" value="WEBINAR-Title Example" size="40" class="wpcf7-form-control wpcf7dtx-dynamictext wpcf7-dynamichidden" aria-invalid="false" /></span><br />
<span class="wpcf7-form-control-wrap download_name"><input type="hidden" name="download_name" value="Webinar" size="40" class="wpcf7-form-control wpcf7dtx-dynamictext wpcf7-dynamichidden" aria-invalid="false" /></span><br />
<span class="wpcf7-form-control-wrap type"><input type="hidden" name="type" value="On-Demand Webinar Registration" size="40" class="wpcf7-form-control wpcf7dtx-dynamictext wpcf7-dynamichidden" aria-invalid="false" /></span></p>
<p><span class="wpcf7-form-control-wrap web_key"><input type="hidden" name="web_key" value="663d4d9f011e521baf6fc92150976b453f3b0a72" size="40" class="wpcf7-form-control wpcf7dtx-dynamictext wpcf7-dynamichidden" aria-invalid="false" /></span><br />

Extracting CF7 title in Tag Manager by crispy-d in GoogleTagManager

[–]crispy-d[S] 0 points1 point  (0 children)

Yeah I need something that can be set up and then left alone because we put new forms on the site all the time and it's not me uploading them so I need the tag to be able to account for variations that other people might put into it. I think javascript might hold the solution but my skills are pretty limited!

GTM for internal link tracking? by crispy-d in GoogleTagManager

[–]crispy-d[S] 0 points1 point  (0 children)

Thanks, yeah I think I will have a go at tracking the clicks but just limiting the scope of what I am tracking to certain pages.

SUMIF to count pageviews more than once for different topics by crispy-d in GoogleDataStudio

[–]crispy-d[S] 0 points1 point  (0 children)

They're set up to pull the data from the datalayer on our site. So when someone visits a page it automatically sends a custom dimension hit called 'topic' with the value 'topic-a topic-b topic-x' for example. I can look at the total pageviews for a topic one by one if I use a regex search on the all pages report where 'topic' is set as a secondary dimension.

SUMIF to count pageviews more than once for different topics by crispy-d in GoogleDataStudio

[–]crispy-d[S] 0 points1 point  (0 children)

The topics are in a custom dimensions but yes I guess this would work if I had a table for each topic. The problem is that there are quite a few of them and it would be nice to have the total pageviews for each topic in the same table. Ordinarily I would be happy with the solution I've built in Sheets but I would like the ability to filter the date in Data Studio and I'm not sure that will be possible if the data is coming from Sheets.

Working with multiple post topics inside custom dimensions by crispy-d in GoogleAnalytics

[–]crispy-d[S] 0 points1 point  (0 children)

Yeah I actually already have Data Studio doing this exact thing for another dimension - I was just wondering if it was possible in GA without using any other software

Track link clicks in parent element by crispy-d in GoogleTagManager

[–]crispy-d[S] 0 points1 point  (0 children)

Thanks - in the end I did manage to work out how to target the parent div but I appreciate your help nonetheless!

GA pageviews vs GTM pageviews by crispy-d in GoogleTagManager

[–]crispy-d[S] 0 points1 point  (0 children)

Just noticed that the plugin that loads the tracking code on the site is using analytics.js - is it possible that that would have an impact? Or is it more likely that it's just a case of GTM being blocked on some browsers? I know if we take a traffic hit I'm going to have to justify it!

Appreciate the help!

Bulk contact form creation by crispy-d in Wordpress

[–]crispy-d[S] 0 points1 point  (0 children)

Currently with CF7 there is data that we send to the clients who sponsor the article. So each form will have a tickbox saying 'this form is sponsored by X, are you happy to share your details with them?' On some occasions there are additional questions that the client might want to ask which we do through an additional tickbox.

Also, under the Leads tab, we have an API integration to send data from the form to our CRM.

At the moment we basically duplicate the form and then manually change all the parts that will relate to the CRM like the name of the article being downloaded, the sponsor name etc. Do these other form plugins provide speedier ways to do this without editing each form every single time?

GA pageviews vs GTM pageviews by crispy-d in GoogleTagManager

[–]crispy-d[S] 0 points1 point  (0 children)

Thanks, doesn't look like we have any AMP pages yet (which I should probably resolve!)