mhoad / oaf-analytics

Outstanding issues to fix up the analytics implementation on the new OAF website
0 stars 0 forks source link

Add dataLayer to individual job page #5

Open mhoad opened 7 years ago

mhoad commented 7 years ago

Anywhere on the individual job page (example here: https://oaf-production.torchboxapps.com/work-with-us/job-openings/g/?gh_jid=660121) if you could add the following code:

<script>
  dataLayer = [{
    'pageTemplate': 'Individual Job Page',
    'jobTitle': '{{ JOB_TITLE }}',
    'jobCountry': '{{ JOB_COUNTRY }}',
    'locationType': '{{ LOCATION_TYPE }}',
    'careerLevel': '{{ CAREER_LEVEL }}',
    'oafTeam': '{{ TEAM_NAME }}',
    'event': 'sendJobDetails'
  }];
</script>

Those variables should just be interpolated as per the information we already have on the page as shown below: image

phil-mcminn commented 7 years ago

Please bear in mind the placement of your dataLayer code based on the recommendations I've made in issue #2. Your snippet of code should be in the head of your page above your GTM container snippet rather than anywhere on the page.

mhoad commented 7 years ago

Once again this one is entirely my bad. I had two things in my mind when putting that together that:

  1. It may not be possible to know that data ahead of time when rendering the head (some other developers I have worked with struggled with this in different CMS platforms) but if it is not a concern here than no problems.
  2. In my mind at least I was using dataLayer.push hence why I figured where on the page didn't matter especially when I had an event tagged onto it as well. Looking at the code again I clearly am not, thanks for catching that!
nimasmi commented 7 years ago

Jobs can have more than one country, location type, career level and team. Do you want us to send a list of all of them, or just the first?

mhoad commented 6 years ago

I've just spoken with Andrew at OAF about getting this picked up again at some point but I think all of them is probably the correct option here for our use case.

todd-dembrey commented 6 years ago

Hi @mhoad

I've implemented the data layer as you requested above.

This results in the following datalayer for https://oneacrefund.org/work-with-us/job-openings/g/?gh_jid=232837:

dataLayer = [{
    "pageTemplate": "Individual Job Page", 
    "jobTitle": "HR and People Specialist", 
    "jobCountry": ["Ethiopia"], 
    "locationType": ["Field"], 
    "careerLevel": ["Field and Support Professionals"], 
    "oafTeam": ["Program"], 
    "event": "sendJobDetails"
}];

Todd

mhoad commented 6 years ago

Hey @todd-dembrey sorry about the delay in getting back to you on this but I am not actually seeing this data appear in the dataLayer variable at all. Nor am I seeing the sendJobDetails event firing. Just wondering if I am missing something obvious on my end potentially?

todd-dembrey commented 6 years ago

Hi @mhoad This isn't deployed to the live site yet, but is available on the staging site, I apologies, i wasn't that clear above. Do you have access to staging? I updated the main ticket with this information, but you may not have access to that. Let me know and i can give you more information.

mhoad commented 6 years ago

Yeah can you shoot me details to mark@afterwire.com.au when you have a chance? Cheers

On Wed, 9 May 2018 at 16:46, Todd Dembrey notifications@github.com wrote:

Hi @mhoad https://github.com/mhoad This isn't deployed to the live site yet, but is available on the staging site, I apologies, i wasn't that clear above. Do you have access to staging? I updated the main ticket with this information, but you may not have access to that. Let me know and i can give you more information.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mhoad/oaf-analytics/issues/5#issuecomment-387637415, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIHjSPihGJS20XgI-aMuSrhjBJdekVrks5twpC_gaJpZM4OAAC- .