Ok guys! Great News. I finally got everything working correctly! After a few changes on Wednesday, I started getting data into GA's correctly for the most part. The filtering process is working correct. The issue I've kept running into was, I kept getting Events pushed into GA without a model in the Events Label. I checked and checked and I narrowed it down to strictly mobile devices but it wasn't all of them. Only a percentage of them wasn't inserting the model into the Event's Label. I figured out what it was. GTM was firing before the script was loading on the page and returning back a 'Not Read' item in the Events label section of the Event. Anyways... I have just now gotten it corrected and I'll pass this info to you so that way you won't run into the same issues. I did try your method
@craigh with placing a global variable on the page via the Meta Tag container and I ran into issues with it. This was before I added logic GTM to wait for the DOM to partially load. I still think your way is prob a little easier if I wanted to apply the code to the individual pages on the website. The method I'm using, everything is basically done via GTM.
First and foremost, for my method to work, you need to have GTM on your website.
Here's the script you'll need. (Remember, this entire method is done via GTM and tailored for my URL structure. You may have to edit depending on yours)
In GTM create a new custom JavaScript variable in the Page Variables section. Copy the script and place it in the script section. Hit save and name it whatever you want. (Remember, if your URL structure vary's between new and used cars, you'll need to create one for each URL structure)
function() {
var pathArray1 = window.location.pathname.split( '/' );
var pathArray = pathArray1[3].split('-');
var PathYear = pathArray[0];
var PathMake = pathArray[1];
var PathModel = pathArray[2];
var pathDataCombined = pathArray[0]+' '+pathArray[1]+' '+pathArray[2];
return pathDataCombined;
}
Next step is to set up your Trigger's in GTM
Click on Triggers>New
You need to select 'DOM Ready' for your trigger.
Next, you don't won't the TAG to wait for the entire page to load. So select 'Some DOM Ready Events'. Then, below that item, you have 3 defining options you can select to specifically happen for that Trigger. For me, I chose ('url' 'contains' 'new/Toyota'). All of my new Toyota VDP's contain 'new/Toyota'. You will have to have a Trigger for each of your events you want to fire. For me, I have separate Triggers for New, Used and Certified. My certified Trigger is just like the new car trigger except in the last item, I used 'url' 'contains' '
certified/'.
Once you build your first one, it's simple to just copy a trigger. just click copy, edit and rename it and your done!
Once you built out your Triggers, now you are set and ready to build your TAG's.
Open up GA and get your GA Tracking ID. Once you have it,
Click on Tags>New and then on Tag Config. On the window on the left, click on 'Universal Analytics' or 'Classic Analytics' depending on your GA code. If you have Universal Analytics your tracking id will have UA in it. Paste in your tracking ID, your next step is to click the drop down for Page Type and select 'Event'. Name your Category something like like below. You'll have to have seperate Tags if you want to break apart your New, Used and Certified vehicles like I did. This one is for my new cars.
In the action section, Make Sure you name all of the Action Labels the same! This is important!!! It's vital for your GA filter!!!
In the Label section, this is where you will implement the 'Variable' you created in the first step!!! Click on the click on the square lego icon and click on the variable you created for this inventory class!!
In the Triggers section, you want to use the trigger you built for this inventory class in the second step! Once you do that name your Tag, click save and your done.
Next step is to Publish your Tag and verify your tag is working! Click Publish, go through the steps to publish and then click the drop down next to publish in the top right corner and click on 'Preview'. This places a cookie on your PC and the Debug tool is only visible to you and no one else. Navigate to your website's VDP and this is what you should see. You should see your tags name in the window!
Click on the TAG and if your variable JS in GTM is working correctly, you should see your model info in the Event Label section like this
Now we just need to see the data in GA with out all the other stuff diluting it down. It's actually pretty simple to do.
But, man it was hard figuring it out!
Open GA and go to your website. Click on Admin. In the
"View" column, click the drop down for view! Click
'create new view'. Give it a name and click create view.
Next click on filters> Add filter!! Give the filter a name. I named mine Cross Shopping. Then click the Include bullet point. In the filter field, you want to select "Event Action" and in the filter pattern,
this is where VDP View from the Event Action is important. Input that into that field.
Now The only events that will populate into this custom view you created is the Events with the Event Action label "VDP View". Hit save!
I also recommend connecting your Adwords to this view as well. Just click on Adwords Linking under the Property>Product Linking section and you can select your adwords account you have linked to your other view as well! Now you can easily see all the VDP views your adwords spend is providing you!
You will have to give GA a day or two before you can see data in there. It does not work retro. It only works from the time you create the view and apply the filter going forward. You should be able to see real time events though! If you don't see your events in the Real Time view, you need to go back and start backtracking your steps and make sure you have everything in place!
After you get some data in GA, click on Behavior>Events>Event Flow and you should have something like this!
This is a snip from Fridays traffic. Events in GA are a day behind. Once I got the bug worked out this afternoon, I should have better data. Notice the 1st event. Some of them doesn't say a model. That is because I was firing GTM before the page was actually loaded. By Wednesday, I should have some really good data!!! It's been working great this evening with out error!!
I hope this helps some of you guys out there!
Thank you guys for helping and chiming in. If you have any questions, just post them!