-
Author
-
May 29, 2017 at 00:04 #162858jmb597Participant
Hi, I am trying to personalize the dashboard to the gender of the user. I have found 2 solutions…a php one and one using Google tags by way of manipulating the DOM. Anyway, the first one didn’t work because even though I put gender as part of the sign up process fields, the php didn’t seem to know how to or where to read what their gender is and i wasn’t sure how to change that. So, then I did the google one like this:
The problem is…this them is different than most regarding structure, so Im unsure what goes where. Right now i have the data layer in the header.php file and also have this:
if (‘{{Gender}}’ == ‘male’ && ‘{{PageType}}’ == ‘home’) {
jQuery(‘.hero’).css(‘background-image’, function(index, value) {
return value.replace(‘female’, ‘male’);
});
}
in the header, but I’m not sure the dashboard is considered ‘home’ so i tried both ways, home and dashboard and changed my data layer the same way:
dataLayer = [{
“page”: {
“type”: “home”
},
“user”: {
“id”: “1234”,
“gender”: “male” // Can be ‘male’ or ‘female’
}
}];
and then I have the other piece of code that is supposed to go in the body tag of the page (I couldn’t find that in the php files) in a RAW HTML module on that page.
Is there any way you can guide me to where all of these go. For how I have it now, I don’t think it’s working, however, I’m also a female so maybe it knows I am even though I change my gender to male it won’t change.
For the PHP one…That one was just creating to classes…one male and one female and putting in the appropriate background and PHP was:
COPY CODEif ($gender == 'Male') echo '<body class="male"'; if ($gender == 'Female') echo '<body class="female">';
But I wasn’t sure how the $gender would connect to the gender profile question since that was just my making a new field and not assigning a variable to it. Is there a better way to write this php and if so, can you let me know what it is and where I could put it? THANK YOU SO MUCH!!!!!
May 29, 2017 at 00:10 #162860jmb597ParticipantI have some spelling errors in my questions and it won’t let me edit it. SO, the THEM is supposed to be THEME in the second paragraph after the google link. Also, just FYI, I did the instructions for what to do in google tags too, so it’s just matter of placement. THANKS!
May 29, 2017 at 17:37 #162905LauraModeratorHello, will assign the ticket to a higher support level who can help and advise you in your query.
Thanks! ?Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
June 2, 2017 at 19:28 #163321RaduModeratorHi,
I understand what are you asking but this is not a theme problem or a theme question and I don’t have a plug and play or know the solution for this.
Data cannot be manipulated with PHP cuz google tag manager pass that values in js.
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.