Typo3 6.2. cookie consent works only with German language - cookies

I am managing a very old typo3 6.2. website: Gurtenhof
I have successfully integrated a cookie consent banner from Dp Cookie Consent banner
However, the text from the cookie div in the right corner translates only for the German site and not for the Italian or English site. You can switch the languages at the top left of the website. It seems that f:translate does not find the other languages.
The languages are configured using:
[globalVar=GP:L=1]
config{
htmlTag_langKey=it
sys_language_uid=1
language=it
locale_all=it_IT.utf8
}
[end]
[globalVar=GP:L=2]
config{
htmlTag_langKey=en
sys_language_uid=2
language=en
locale_all=en_GB.utf8
}
[end]
Is there any way to pass the current language of the website to the plugin or any other configuration option which I have missed?

The language tags should be in the following form since the plugin directly takes them from the configuration:
[globalVar = GP:L = 2]
page.config.sys_language_uid = 2
page.config.language = en
page.config.locale_all = en_EN.UTF-8
page.config.htmlTag_langKey = en
config.sys_language_uid = 2
config.language = en
config.locale_all = en_EN.UTF-8
config.htmlTag_langKey = en
[global]
Then you can add all the different translations for the languages:
plugin.tx_dp_cookieconsent._LOCAL_LANG.en {
message = This website uses cookies that are necessary for the technical operation of the website and are always set. Other cookies, to personalise content and ads and to analyse traffic to our website, are only set with your consent. We also share information about your use of our website with our social media, advertising and analytics partners.
dismiss = Allow cookies!
allow = Allow cookies!
link = More info
deny = Decline
allowall = Allow cookies!
}
Nonte: Some of the special characters have to be masked using html entities.

Related

How do I embed Superset in an iframe?

I'm trying to embed Superset (version 1.3) in an iframe and I'm getting a DOMException 18. The installation of Superset itself works fine since I can access it normally at its URL. Ultimately, my need is to allow website X of a completely different origin to embed a view of my superset instance.
I've found a number of github issues and articles online suggesting changes to superset_config.py to allow embedding superset in an iframe and I've made a few of them. In particular, I've made the following changes to config.py (rather than superset_config.py as a temporary measure to be sure that the config changes were indeed being registered):
from .mysecurity import CustomSecurityManager
CUSTOM_SECURITY_MANAGER = CustomSecurityManager
ENABLE_PROXY_FIX = True
HTTP_HEADERS: Dict[str, Any] = {'X-Frame-Options': 'ALLOWALL'}
SESSION_COOKIE_SECURE = True
SESSION_COOKIE_SAMESITE = "None"
I'm using a this as a base for custom security manager (the only changes are that I'm checking a token against another service before logging in the user and I'm providing a redirect in the URL).
This instance of superset is behind NGINX which is setting Access-Control-Allow-Origin * and running with gunicorn.
The following screenshots are from my local host with a basic website that has the following bit of relevant JS logging in a user with role Gamma:
let analytics_div = document.getElementById('analytics');
let report = document.createElement("iframe")
const report_url = new URL("/superset/dashboard/123/?standalone=true", superset_url);
const start_url = new URL(`/login?auth_code=${superset_auth_token}&redirect=${report_url}`, superset_url)
report.src = start_url;
report.width = "100%"
report.height = 700
analytics_div.appendChild(report)
Error I'm getting in the iframe
What I see in the dev tools

How to avoid user having to re-authorize Evernote every time?

I'm building a Python web app with the Evernote API. When users log in they're redirected to a page on the Evernote site to authorize the application. When they come back everything works fine (can see and edit notes etc.)
The challenge now is to avoid having to redirect the user to the Evernote site every time they log on.
I read on the Evernote forums that I need to save the access token and the notestore url to achieve this. I now save these to the users accounts after the first successful authorization.
But how do I use the access token and notestore url to authorize?
I found this sample code on the Evernote website that's supposed to achieve this, but it's in Java and I can't seem to make it work in Python.
// Retrieved during authentication:
String authToken = ...
String noteStoreUrl = ...
String userAgent = myCompanyName + " " + myAppName + "/" + myAppVersion;
THttpClient noteStoreTrans = new THttpClient(noteStoreUrl);
userStoreTrans.setCustomHeader("User-Agent", userAgent);
TBinaryProtocol noteStoreProt = new TBinaryProtocol(noteStoreTrans);
NoteStore.Client noteStore = new NoteStore.Client(noteStoreProt, noteStoreProt);
Basically, if you got the notestore url and access token from a previous authorization, how do you use them to re-authorize?
If you have the access token, you will use that as a constructor argument for the EvernoteClient class.
For example:
client = EvernoteClient(token=your_access_token)
note_store = client.get_note_store()
notebooks = note_store.listNotebooks();
for n in notebooks:
print n.name
For more examples, check out the Python Quick-start Guide.

Disable the CloudFlare Mobile Redirect for full site on mobile device

On my web site we have activated the mobile redirect from cloudflare.
Now we want the access to full site on mobile device.
From cloudflare support we found "__cf_mob_redir = 0; domain=.example.com" for disable the mobile redirect (m.) but i dont know how to implement this cookie parameter to a real html link (for Desktop site link ) / php function (get ?) for the cokkie and redirect to the desktop page (www.).
Thanks in advance ... cookie is my nightmare.
I think the answer in Set cookie (with JS) for whole domain not specific page should help with structuring your cookie:
Example from that page:
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/";
}
"You can specifiy domain ;domain=.example.com as well as path ;path=/ ("/" set cookie in whole domain)"

Specifying a FB Page for a desktop/mobile news feed ad using Python SDK

I'm new to the Facebook Ads Python SDK and am trying to create an ad that will display on mobile and desktop news feeds. Reviewing the web flow to create an ad, to show up in a feed, the ad needs to be related to a Facebook page. I manage a Facebook page, but am not sure where I need to input the FB page info.
I've reviewed the documentation and getting started examples, however the getting started is about a page post ad, so not relevant to me. I assumed "Placements" would be relevant but nothing I find there is helpful either. I also looked at Connection objects but that also seemed a dead end.
The code I've got runs and creates ads that are right column ads. I've tried adding "page_types: ['feed']" to AdSet targeting but that returns an error saying that placement is ineligible for this ad.
Could someone point me in the right direction on how to create an ad that will show up in the desktop news feed? Meat of the code is below.
`
# create campaign
campaign = AdCampaign(parent_id=config['act_account_id'])
campaign[AdCampaign.Field.name] = 'Test Campaign'
campaign[AdCampaign.Field.status] = AdCampaign.Status.paused
campaign[AdCampaign.Field.objective] = AdCampaign.Objective.website_clicks
campaign.remote_create()
# create adset
targeting = {
#'page_types': ['feed'],
'geo_locations': {
'cities': [{'key': '2532348', 'radius': 25, 'distance_unit': 'mile'}]
}
}
data = {
AdSet.Field.name: 'My Python SDK AdSet',
AdSet.Field.bid_type: AdSet.BidType.cpc,
AdSet.Field.is_autobid: True,
AdSet.Field.status: AdSet.Status.active,
AdSet.Field.lifetime_budget: 500,
AdSet.Field.end_time: '2015-06-4 23:59:59 PDT',
AdSet.Field.campaign_group_id: config['campaign_id'],
AdSet.Field.targeting: targeting,
}
adset = AdSet(parent_id=config['act_account_id'])
adset.remote_create(params=data)
# Set up creative for ad
image = AdImage(parent_id=config['act_account_id'])
image[AdImage.Field.filename] = image_filename
image.remote_create()
creative = AdCreative(parent_id=config['act_account_id'])
creative[AdCreative.Field.name] = 'sample creative'
creative[AdCreative.Field.title] = 'ad headline'
creative[AdCreative.Field.body] = 'ad text'
creative[AdCreative.Field.object_url] = 'www.http://www.misc-url.com'
creative[AdCreative.Field.image_hash] = image[AdImage.Field.hash]
creative.remote_create()
# Create your ad by referencing the ad creative.
adgroup = AdGroup(parent_id=config['act_account_id'])
adgroup[AdGroup.Field.name] = 'Testing SDK Ad'
adgroup[AdGroup.Field.campaign_id] = config['adset_id']
adgroup[AdGroup.Field.creative] = {'creative_id': str(creative_id)}
adgroup[AdGroup.Field.status] = AdGroup.Status.paused
adgroup.remote_create()
`
There is an api call to create a page post at the time of ad creation:
https://developers.facebook.com/docs/marketing-api/adcreative/v2.3#object_story_spec
See the blog post for more detailed info:
https://developers.facebook.com/ads/blog/post/2014/08/28/creative-page-post-api

Google Analytics URL Percent-encoding Issue with Cross Domain Cookie

Google Analytics is not understanding a URL Percent-encoding so I can track multiple domains between my "source" domain and my "destination" domain. I'm using Google Tag Manager + the new Universal Analytics.
Is there a macro or rule in google tag manager that I can create to help Google Analytics detect these two URL Percent-encoding as %2526 for & and %253d for = appropriately? If so, is there any support that could be provided with this issue I'm experiencing?
Here is an example URL (not real):
http://subdomain.example.com/adfs/ls/?wa=wsignin1.0&wtrealm=https%3a%2f%2fsub.domain.com%2fwebsite%2f&wctx=rm%3d0%26id%3dpassive%26ru%3d%252fwebsite%252fsite%252fexample%252f%253fstuff%253dtypeofuser%2526_ga%253d1.244536837.1471787898.1397850931&wct=2014-04-18T20%3a14%3a54Z
As you can see close to the tail end of URL contains my _ga cookie that originated from my "source" domain and is getting passed to my "destination" domain. This is a good thing, however GA is not able to read it, because of the URL Percent-encoding shown below:
%2526_ga%253d1.244536837.1471787898.1397850931
%2526 is a URL encode for &
%253d is a URL encode for =
Since google analytics is not able to translate the URL Percent-encoding %2526 and %253d it writes a brand new cookie instead when I look at my cookies when I debug using firebug > cookies tab.
The solution I found that solves this problem is to append the cookie to the URL again on page load so so the cookie can be read by google analytics.
The regex for .match can be customized with your URLs that you need to filter.
var gacookie = window.location.search.match('_ga%253d(.+)&wct=');
var url = window.location.href;
if (url.indexOf('_ga') > -1) {
url += '&_ga=' + gacookie[1]
parent.location.hash = url
var hash = location.hash.replace('#', gacookie[1]);
if(hash != '') {
location.hash = '&_ga=' + gacookie[1];
}
}